我已经使用这段代码连接到数据库..它显示错误,如ConnectionString属性尚未初始化。错误:ConnectionString属性尚未初始化?
Dim sConnString As String = "user id=" + sUserID + ";password=" + sPwd + ";initial catalog=" + sDatabase + ";Connect Timeout = 30" + ";Pooling=true;Max Pool Size=" + MaxPoolSize + ";Min Pool Size=" + MinPoolSize + ";"
Dim Conn As New SqlConnection()
Dim cmd As New SqlCommand()
cmd.CommandText = "INSERT INTO NEC_Customer_Mst(Customer_Code,Customer_Name) VALUES(Customercode,Customername)"
cmd.Connection = Conn
Conn.Open()
cmd.ExecuteNonQuery()
Conn.Close()
任何建议?
我给它就像它显示像System.ArgumentException错误:关键字不支持:'连接超时'。 – bala3569 2011-02-24 12:35:22
@ bala3569:你可以试试'Connection Timeout'或'Timeout' – 2011-02-24 13:35:12
@ bala3569:我还注意到你没有指定一个'Server'或'Data Source'。 – 2011-02-24 13:38:13