Click here to Skip to main content
15,510,771 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want create progaram

when i was create Query in SQL like insert then i debag in SQL
in SQL is true run but when i send (Query) with c# to SQL not work

i have NOT error and bog in c# but when send QUERY to SQL i can not insert


if you can help me i really appreciate .....!?!?
Posted
Comments
Hiren solanki 29-Sep-10 4:39am    
if there is not error there should not be problem, check your data runtime.
Sushant Joshi 29-Sep-10 6:25am    
Try debugging, check if the runtime script which you are generating has any errors, also execute the script in Query Analyzer and check if the data is getting inserted.
varun.maism 29-Sep-10 6:51am    
paste your code here. than people might give u the right ns where the problem exists.
Sandeep Mewara 29-Sep-10 8:57am    
C# code?

1 solution

if your problem is when inserting....then definitely there should be problem in your query....

try this....

cmd = new sqlcommand("INSERT INTO emptable(EMP_NAME)VALUES('"+textbox1+"')", sqlconn);
sqlconn.Open();
cmd.ExecuteNonQuery();
sqlconn.Close();


If the above solution is same as yours....try connecting your connection like....

con = new sqlconnection(@"Data Source = A\SQLEXPRESS;Initial Catalog=empDB;Integrated Security = True");
 
Share this answer
 
v4
Comments
Hiren solanki 29-Oct-10 22:55pm    
Code block fixing.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900