Problem with Insert statement...

Discussion in 'ASP .Net' started by Paul Mason, Jun 7, 2005.

  1. Paul Mason

    Paul Mason Guest

    Hi folks,

    The ado.net stream appears to be not working so I'm here.

    The following function generates the error "Operation must use an updateable
    query". There is no identifiable or meaningful error code.

    This system is using OLEDB to connect to an Access database. I've tried
    applying the insert statement directly to the Access database and it works
    fine.

    I'm not sure whether this is because the connection isn't allowing updates
    or whether there's something odd about the insert statement.

    Cheers...P


    Public Function AddMatchReport(ByVal lngTeamMatchID As Long, ByVal
    lngMemberID As Long, ByVal strReport As String) As Boolean

    Dim cm As OleDb.OleDbCommand

    Dim adp As OleDb.OleDbDataAdapter

    Dim ds As Data.DataSet

    Dim rw As DataRow

    Dim strRet As String

    If Me.Connection.State = ConnectionState.Closed Then

    Me.Connection.Open()

    End If

    cm = New OleDb.OleDbCommand

    cm.Connection = Me.Connection

    cm.CommandText = "INSERT INTO tbTeamMatchReport (TeamMatchID, MemberID,
    Report) " & _

    "VALUES (" & lngTeamMatchID & ", " & lngMemberID & ", " & _

    Chr(34) & strReport & Chr(34) & ")"

    'cm.CommandType = CommandType.Text

    If cm.ExecuteNonQuery() = -1 Then

    Return True

    Else

    Return False

    End If



    End Function
     
    Paul Mason, Jun 7, 2005
    #1
    1. Advertising

  2. > I'm not sure whether this is because the connection isn't allowing updates
    > or whether there's something odd about the insert statement.


    Most likely neither. In all probability the user account under which ASP.Net
    is running does not have "change" permission for the folder containing the
    database. Note that this refers to file system security and permissions, NOT
    web server permissions.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    Ambiguity has a certain quality to it.

    "Paul Mason" <> wrote in message
    news:...
    >
    > Hi folks,
    >
    > The ado.net stream appears to be not working so I'm here.
    >
    > The following function generates the error "Operation must use an
    > updateable query". There is no identifiable or meaningful error code.
    >
    > This system is using OLEDB to connect to an Access database. I've tried
    > applying the insert statement directly to the Access database and it works
    > fine.
    >
    > I'm not sure whether this is because the connection isn't allowing updates
    > or whether there's something odd about the insert statement.
    >
    > Cheers...P
    >
    >
    > Public Function AddMatchReport(ByVal lngTeamMatchID As Long, ByVal
    > lngMemberID As Long, ByVal strReport As String) As Boolean
    >
    > Dim cm As OleDb.OleDbCommand
    >
    > Dim adp As OleDb.OleDbDataAdapter
    >
    > Dim ds As Data.DataSet
    >
    > Dim rw As DataRow
    >
    > Dim strRet As String
    >
    > If Me.Connection.State = ConnectionState.Closed Then
    >
    > Me.Connection.Open()
    >
    > End If
    >
    > cm = New OleDb.OleDbCommand
    >
    > cm.Connection = Me.Connection
    >
    > cm.CommandText = "INSERT INTO tbTeamMatchReport (TeamMatchID, MemberID,
    > Report) " & _
    >
    > "VALUES (" & lngTeamMatchID & ", " & lngMemberID & ", " & _
    >
    > Chr(34) & strReport & Chr(34) & ")"
    >
    > 'cm.CommandType = CommandType.Text
    >
    > If cm.ExecuteNonQuery() = -1 Then
    >
    > Return True
    >
    > Else
    >
    > Return False
    >
    > End If
    >
    >
    >
    > End Function
    >
    >
    >
     
    Kevin Spencer, Jun 7, 2005
    #2
    1. Advertising

  3. Paul Mason

    Paul Mason Guest

    I don't believe it....arghhhhhhh!!

    Thanks, that works fine now....P


    "Kevin Spencer" <> wrote in message
    news:...
    >> I'm not sure whether this is because the connection isn't allowing
    >> updates or whether there's something odd about the insert statement.

    >
    > Most likely neither. In all probability the user account under which
    > ASP.Net is running does not have "change" permission for the folder
    > containing the database. Note that this refers to file system security and
    > permissions, NOT web server permissions.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > Ambiguity has a certain quality to it.
    >
    > "Paul Mason" <> wrote in message
    > news:...
    >>
    >> Hi folks,
    >>
    >> The ado.net stream appears to be not working so I'm here.
    >>
    >> The following function generates the error "Operation must use an
    >> updateable query". There is no identifiable or meaningful error code.
    >>
    >> This system is using OLEDB to connect to an Access database. I've tried
    >> applying the insert statement directly to the Access database and it
    >> works fine.
    >>
    >> I'm not sure whether this is because the connection isn't allowing
    >> updates or whether there's something odd about the insert statement.
    >>
    >> Cheers...P
    >>
    >>
    >> Public Function AddMatchReport(ByVal lngTeamMatchID As Long, ByVal
    >> lngMemberID As Long, ByVal strReport As String) As Boolean
    >>
    >> Dim cm As OleDb.OleDbCommand
    >>
    >> Dim adp As OleDb.OleDbDataAdapter
    >>
    >> Dim ds As Data.DataSet
    >>
    >> Dim rw As DataRow
    >>
    >> Dim strRet As String
    >>
    >> If Me.Connection.State = ConnectionState.Closed Then
    >>
    >> Me.Connection.Open()
    >>
    >> End If
    >>
    >> cm = New OleDb.OleDbCommand
    >>
    >> cm.Connection = Me.Connection
    >>
    >> cm.CommandText = "INSERT INTO tbTeamMatchReport (TeamMatchID, MemberID,
    >> Report) " & _
    >>
    >> "VALUES (" & lngTeamMatchID & ", " & lngMemberID & ", " & _
    >>
    >> Chr(34) & strReport & Chr(34) & ")"
    >>
    >> 'cm.CommandType = CommandType.Text
    >>
    >> If cm.ExecuteNonQuery() = -1 Then
    >>
    >> Return True
    >>
    >> Else
    >>
    >> Return False
    >>
    >> End If
    >>
    >>
    >>
    >> End Function
    >>
    >>
    >>

    >
    >
     
    Paul Mason, Jun 8, 2005
    #3
    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. Replies:
    3
    Views:
    833
  2. compuglobalhypermeganetz0r

    adapter update problem Syntax error in INSERT INTO statement.

    compuglobalhypermeganetz0r, Dec 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    853
    compuglobalhypermeganetz0r
    Dec 8, 2003
  3. ddog
    Replies:
    1
    Views:
    2,112
    Thomas Kellerer
    Feb 7, 2007
  4. Jason Melville
    Replies:
    4
    Views:
    137
    PB4FUN
    Sep 16, 2003
  5. J. Muenchbourg
    Replies:
    3
    Views:
    258
    Aaron Bertrand - MVP
    Sep 30, 2003
Loading...

Share This Page