Running a stored procedure

  • Thread starter Thread starter Broggy69
  • Start date Start date
B

Broggy69

Guest
I know my connection works because I can create a stored procedure

As shown below

Dim qry_001 As OleDbCommand = New OleDbCommand("CREATE PROC qry001 AS UPDATE [Input] SET [Input].NewDesc = 'Test Update';", Conn_1)


I see it in MS-Access and it works when I run it in Access along with 10 other queries

But in Visual Basic it is not running. Below is the code.

I do not get an error message when running but no updates happen

Dim cmdT As OleDbCommand = New OleDbCommand()

in the log file
Dim Queries() As String = {
"qry001",
"qry002",
"qry003",
"qry004",
"qry005",
"qry006",
"qry007",
"qry008",
"qry009",
"qry010"}

cmdT.Connection = Conn_1
cmdT.CommandType = CommandType.StoredProcedure

Conn_1.Open()
For Each qry As String In Queries

Try
cmdT.CommandText = qry
cmdT.ExecuteNonQuery()
txt_Prog.AppendText(qry & " Happiness" & vbCrLf)
Catch ex As Exception
txt_Prog.AppendText(qry & " Sadness" & vbCrLf)
End Try


Next
Conn_1.Close()
All these queries work inside of MS-Access

Continue reading...
 
Back
Top