in the below quote i took from Devasya i implemented in SQL MS VS 2008, and there is an error coming any idea about it????
The code is :
db.openConnection();
int j = 0;
int k = 0;
string[,] a = new string[100, 100];
string data = "\"";
for (k = 0; k < (countRow - 1); k++)
{
for (j = 0; j < (countCol); j++)
{
MessageBox.Show("j=" + j);
MessageBox.Show("k=" + k);
a[j, k] = string.Format("" + dgvAList[j, k].Value);
if ((j == (countCol - 1)) && (k == 1))
{
data = data + a[j, k] + "'";
}
else
if (j < (countRow - 1))
{
data = data + a[j, k] + "','";
}
MessageBox.Show("a[" + j + "," + k + "]=" + a[j, k]);
MessageBox.Show("a = " + data);
}
String query = @"Insert Into Action (Description,AssignedTo,DueDate,Status,DateCompleted,Comment)" + " Values (" + data + ")";
SqlCommand command = new SqlCommand(query, DB.getConnection());
command.ExecuteNonQuery();
db.closeConnection();
There is an error coming in
command.ExecuteNonQuery();
saying :
Unclosed quotation mark after the character string 'True','Executivve Summary','Rohan','1/12/2010 12:00:00 AM','True','','',')'.
Incorrect syntax near 'True','Executivve Summary','Rohan','1/12/2010 12:00:00 AM','True','','',')'.
the error
why is this???