General information
Title:
Insert in Sql table
Hi,
I am trying to insert data in sql server in C#.
When I write
string insertstring = @"insert into _4_claim_dbf_temp(batch_num, TKS_NO, claim_num, Client)values('ll1111', 'l1111l', '22222', 'Lp')";
and use
cmd3=new SqlCommand(insertstring,conn3);
cmd3.ExecuteNonQuery();
This works fine but in the above query if I use variables in the values part, like
string insertstring = @"insert into _4_claim_dbf_temp(batch_num, TKS_NO, claim_num, Client)values(batch_num, TKS_NO, CLAIM_NUM, 'Lp')";
where batch_num and other variables gets value like
string batch_num = pRow["org_batch"].ToString();
batch_num = batch_num.Trim();
I get exception error. Where am I wrong here.
Thanks
Bharat
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only