I have used this piece of code for connecting to the database..It is showing error like The ConnectionString property has not been initialized.
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()
Any suggestion?
I would change your code so that you use a
usingstatement. This way it will clean up resources when it has finished.