Server Error in '/' Application - when executing stored query - novice question

S

sean

Hi
I am trying to execute an ms access stored query, I keep getting an error
when I try to execute the code.I know that I am missing some declarations in
my script, I am just not sure on the syntax.

Sean

error -----------------------------------


Line 49: Try
Line 50: objConn.Open()
Line 51: DG1.DataSource = objCmd.ExecuteReader
Line 52: DG1.DataBind()
Line 53:



!--------------------------------- code
Dim strConnect As String
Dim DG1 as SqlDataReader


strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;"
strConnect += "Data Source =" & Server.MapPath("1t.mdb") & ";"
strConnect += "Persist Security Info=False"


Dim objConn As New OleDbConnection(strConnect)
Dim objCmd As New OleDbCommand()
Dim objParam As OleDbParameter

With objCmd
.Connection = objConn
.CommandText = "sp_deletebyid"
.CommandType = CommandType.StoredProcedure
objParam = .Parameters.Add("ID", OleDbType.Integer)
End With

objParam.Direction = ParameterDirection.Input
objParam.Value = strChkBoxValue

Try
objConn.Open()
DG1.DataSource = objCmd.ExecuteReader
DG1.DataBind()

Catch objError As Exception
lblMessage.Text = objError.Message

Finally
objConn.Close()

End Try
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top