你试试用工具箱里面的SQLCONNECTION和SQLCOMMANDSQLCONNECTION可以以向导模式让你连接数据库
解决方案 »
- alert弹出窗口问题
- 如何使用 VS2008 自带的打包程序?
- 对不起,很久没来,每分给了。如何枚举一个程序集(dll)中from成员信息?
- 在winfrom里,做个浏览器,要实现调用Alexa排名控件要如何做呢?
- C# B/S 程序 将画面上的 htmltable显示的结果输出到Excel中,求代码!
- gridview与formview配合显示数据
- 我有两个用户控件,每个用户控件都有一个textbox,ID相同,我现在想写个方法,根据不同的页面传递不同的值给textbox?
- toolbar添加两个控件,但是两个叠在一起
- 高分弱智问题,关于winform窗体弹出的!
- C#通过创建word模版报错!求解
- 窗体间传递数据的问题!!!求高手指教!!!
- 我知道一个树型菜单的一个接点,它没有父接点,但是我还是必须去判断它有没有,请问该怎么判断啊?谢谢了(急,在线)
换成
conn = "Data Source=.;integrated security=SSPI;Connection Timeout = 5;user id=sa;password=811215;initial catalog=mypage;";
看看
改成sub.Append("VALUES('{0}','{1}','{2}')");
还有values.Add(0);是什么意思
conn=new SqlConnection("Data Source=XUEXUEGO-NRHZVJ;initial Catalog=mypage;User id=sa;Pwd=811215");
Standard Security:"Driver={SQL Server};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;" Trusted connection:"Driver={SQL Server};Server=Aron1;Database=pubs;Trusted_Connection=yes;" Prompt for username and password:oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};Server=Aron1;DataBase=pubs;" OLE DB, OleDbConnection (.NET)
Standard Security:"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;" Trusted Connection:"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
(use serverName\instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)
Prompt for username and password:oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Data Source=Aron1;Initial Catalog=pubs;" Connect via an IP address:"Provider=sqloledb;Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))
SqlConnection (.NET)
Standard Security:"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
- or -
"Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
(booth connection strings produces the same result)
Trusted Connection:"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
- or -
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
(booth connection strings produces the same result)(use serverName\instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)
Connect via an IP address:"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))
Declare the SqlConnection:C#:
using System.Data.SqlClient;
SqlConnection oSQLConn = new SqlConnection();
oSQLConn.ConnectionString="my connectionstring";
oSQLConn.Open(); VB.NET:
Imports System.Data.SqlClient
Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString="my connectionstring"
oSQLConn.Open()