Jiggs Roger

Jiggs Roger

  • NA
  • 5
  • 0

Unable to perform edit operations on a db using queries on vb.net code

Apr 4 2010 3:27 PM

Hi!

I have a strange predicament with a vb.net module that i am attempting to use. I can perform 'select' query operations on my db, mainDB. A table tblGetsUpdated has certain records that need to be updated on runtime from a form of a windows app. Any other query with an 'update' or 'insert' do not seem to work at all. Any thing I might missing out on? Tried looking all over the place to see for solutions but there isn't a similar case anyplace.

My specs are as follows.

  • VS 2008
  • MS SQL Express 2008
  • Attempting Windows Application

Here is a sample that doesn't change the db contents.

Dim icount
Dim mycon As SqlClient.SqlConnection = New SqlClient.SqlConnection()
mycon.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\mainDB.mdf;Integrated Security=True;User Instance=True"
mycon.Open()
Dim sqlquery As String
sqlquery = "Update tbllogin set locked=0 where U_Id='" & UID & "'"
Dim myCommand As New SqlClient.SqlCommand(sqlquery, mycon)
icount = myCommand.ExecuteNonQuery

Any help would be greatly appreciated. Thanks!

Answers (1)