Need4Speed
Member
- Joined
- Apr 4, 2007
- Messages
- 8
- Programming Experience
- Beginner
Hi. Sorry about the n00by question but I'm kinda new to vb.net
I want to execute a simple 'insert' query by doing this:
When an errors occurs I get the appropriate message like table does not exist or something like that BUT, and here's the problem, when everything's fine after having executed the code nothing changes in the database. What am I doing wrong?
Thx a lot..
I want to execute a simple 'insert' query by doing this:
VB.NET:
con.Open()
strSqlString = "INSERT INTO " & strTable & "(" & strColumns & ") VALUES(" & strValues & ")"
Dim cmd As New SqlCommand(strSqlString, con)
intNumAffected = cmd.ExecuteNonQuery()
con.Close()
When an errors occurs I get the appropriate message like table does not exist or something like that BUT, and here's the problem, when everything's fine after having executed the code nothing changes in the database. What am I doing wrong?
Thx a lot..