Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert in Sql table
Message
From
12/01/2005 22:12:09
 
 
To
All
General information
Forum:
ASP.NET
Category:
Databases
Title:
Insert in Sql table
Miscellaneous
Thread ID:
00976656
Message ID:
00976656
Views:
48
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
Map
View

Click here to load this message in the networking platform