Problem with Insert statement...

P

Paul Mason

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
 
K

Kevin Spencer

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.
 

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,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top