我已經使用這段代碼連接到數據庫..它顯示錯誤,如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