Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem with Insert statement...

Reply
Thread Tools

Problem with Insert statement...

 
 
Paul Mason
Guest
Posts: n/a
 
      06-07-2005

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



 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      06-07-2005
> 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
>
>
>



 
Reply With Quote
 
 
 
 
Paul Mason
Guest
Posts: n/a
 
      06-08-2005


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
>>
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Multiple Records Using One Insert Statemen with MySQLdb module anton.ranieri.it@gmail.com Python 1 12-06-2008 12:47 PM
insert in std::map does not insert the object simon.elbaz@free.fr C++ 1 11-04-2007 11:42 PM
Insert & Insert/Repeat buttons in a detailsview eagle ASP .Net Datagrid Control 0 07-12-2007 12:47 PM
Detailsview loses insert mode contents when Insert fails... cannontrodder ASP .Net 1 07-25-2006 08:38 AM
DetailsView - Changing to Insert Mode (Not By Using the Insert Button In the DetailsView Control) Feege ASP .Net Web Controls 0 12-20-2005 12:28 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57