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

Discussion in 'ASP .Net' started by sean, Dec 2, 2003.

  1. sean

    sean Guest

    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
     
    sean, Dec 2, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sean
    Replies:
    2
    Views:
    2,377
  2. sean
    Replies:
    2
    Views:
    546
    Kevin Spencer
    Dec 2, 2003
  3. Peri
    Replies:
    1
    Views:
    404
    Patrick Olurotimi Ige
    Jun 13, 2005
  4. bb

    novice template query

    bb, Apr 12, 2006, in forum: C++
    Replies:
    11
    Views:
    578
    red floyd
    Apr 18, 2006
  5. Replies:
    1
    Views:
    1,845
    smcneill
    Oct 15, 2007
Loading...

Share This Page