tracy_p
asked on
executeNonQuery: Connection property has not been initialized --vb.net2.0
Hi
when i am clicking submit button which inserts record into sqlserver ,i amexperiencing this error.
executeNonQuery: Connection property has not been initialized.
here is my code.
using .net2.0/vb.net/sql
Thank you
when i am clicking submit button which inserts record into sqlserver ,i amexperiencing this error.
executeNonQuery: Connection property has not been initialized.
here is my code.
using .net2.0/vb.net/sql
Thank you
Dim myconn As SqlConnection
Dim mycommand As SqlCommand
myconn = New SqlConnection("Server=NAb;DataBase=conn; uid=sa;pwd=connect")
myconn.Open()
mycommand = New SqlCommand("Insert into register(name,password) values ('" + TextBox1.Text + "','" + TextBox2.Text + "'),myconn")
mycommand.ExecuteNonQuery()
myconn.Close()
Hi tracy_p,
Try this way:
mycommand = New SqlCommand("Insert into register([name],[password] ) values ('" + TextBox1.Text + "','" + TextBox2.Text + "'),myconn)
mycommand.ExecuteNonQuery( )
Try this way:
mycommand = New SqlCommand("Insert into register([name],[password]
mycommand.ExecuteNonQuery(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i tried both but same error message
Try last one ... I have miss my post!
ASKER
thanks jpaulino
Also don't forget that password is an reserved word from SQL and you should always use this way [password]
Glad I could help and thanks for the grade!
jpaulino
Glad I could help and thanks for the grade!
jpaulino
myconn.Open()
mycommand = New SqlCommand("Insert into register(name,password) values ('" + TextBox1.Text + "','" + TextBox2.Text + "'),myconn")