TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
manilike mani
NA
2
1.4k
i am try to update string into integer from database
Oct 5 2015 2:26 AM
char[] section = new char[6];
section[0] = '0';
section[1] = 'A';
section[2] = 'B';
section[3] = 'C';
section[4] = 'D';
section[5] = 'E';
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
int a;
try
{
a = int.Parse(dataGridView1.Rows[i].Cells["dgvcsection"].Value.ToString());
}
catch
{
a = 0;
}
for (int j = 0; j <= a; j++)
{
//Data.InitConnection();
char b = section[j];
SqlCommand cmd = new SqlCommand("SPClass", Data.connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("ClassID", 0);
cmd.Parameters.AddWithValue("Standard", dataGridView1.Rows[i].Cells["dgvcstandard"].Value.ToString());
cmd.Parameters.AddWithValue("Section", b.ToString());
cmd.Parameters.AddWithValue("pindex", i + 1);
cmd.Parameters.AddWithValue("cindex", j);
cmd.Parameters.AddWithValue("Batch", textBox1.Text);
cmd.Parameters.AddWithValue("@created_ by", Mashupdata.EmployeeID);
cmd.Parameters.AddWithValue("@created_date", "0");
cmd.Parameters.AddWithValue("@modified_by", Mashupdata.EmployeeID);
cmd.Parameters.AddWithValue("@modified_date", "0");
cmd.Parameters.AddWithValue("@ext", "0");
cmd.ExecuteNonQuery();
MessageBox.Show("class allotted successfully");
}
}
} Data.CloseConnection();
}
catch(Exception ex)
{
Utility.ErrorLog.WriteToFile(Mashupdata.errorFile, "FrmClassAllotment:button1_Click", ex.Message);
}
Reply
Answers (
1
)
C program error
Use Private constructor and Collection