Groups | Blog | Home
all groups > c# > june 2007 >

c# : Insert Help


Rafael
6/14/2007 11:24:54 PM
I'm receiving this error from the code below.

Unclosed quotation mark before the character string '+1)'.

Line 1: Incorrect syntax near ' + 1)'.).



string InsertDeptType = "INSERT INTO Department(Department_Id,
Department_Desc, Ok_To_Use)"+

" values ('"+ Guid.NewGuid().ToString() +

"','" + drDeptType["DEPT"].ToString()+

"',' + 1)";




SqlCommand cmdInsertDeptType = new SqlCommand(InsertDeptType,
connDestination);

cmdInsertDeptType.ExecuteNonQuery();

Mike Labosh
6/14/2007 11:52:39 PM
[quoted text, click to view]

Try this instead?

"', 1)";

--
Peace & happy computing,

Mike Labosh, MCSD MCT
Owner, vbSensei.Com
"The power to query ADSI is a power only
one has achieved, but if we work together,
I know we can discover the secrets."

AddThis Social Bookmark Button