且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

关于SQL Server 2008和与C#的连接

更新时间:2023-02-02 23:16:02

如果您的问题是在插入...时,那么肯定应该有问题在您的查询中....

试试这个....

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");