关于SQL Server 2008和与C#的连接 [英] about SQL server 2008 and connection to c#

查看:73
本文介绍了关于SQL Server 2008和与C#的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建普罗兰(progaram)

当我在SQL中创建查询(如插入)时,我在SQL中放下了
在SQL中运行是正确的,但是当我使用C#向SQL发送(查询)时无法正常工作

我在C#中没有错误和沼泽,但是在向SQL发送QUERY时我无法插入


如果您可以帮助我,我真的很感激.....!?!?

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 .....!?!?

推荐答案

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

试试这个....

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


这篇关于关于SQL Server 2008和与C#的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆