hitechboy78737
Programmer
How do you pass a parameter from vb.net to an access query?
I'm using this function, what should I add?
Thanks bunches
Kevin Howell
Briefcase of Talent- Austin,Texas
I'm using this function, what should I add?
Code:
Function drFromQuery(ByVal objConn As System.Data.OleDb.OleDbConnection, ByVal strQuery As String)as oledbDataReader
Dim objCommand As New OleDbCommand
Dim objDataReader As OleDbDataReader
objCommand.Connection = objConn
objCommand.CommandText = strQuery
objCommand.CommandType = CommandType.StoredProcedure
Try
objConn.Open()
objDataReader = objCommand.ExecuteReader
If objDataReader.Read = True Then
Return objDataReader
End If
Catch ex As OleDbException
MessageBox.Show(ex.Message, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Catch ex As Exception
MessageBox.Show(ex.Message, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Finally
objCommand.Dispose()
End Try
End Function
Thanks bunches
Kevin Howell
Briefcase of Talent- Austin,Texas