473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Problem with Insert statement...


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

Nov 19 '05 #1
2 1661
> 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" <p.*******@bham.ac.uk> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
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

Nov 19 '05 #2


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

Thanks, that works fine now....P
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:ew**************@TK2MSFTNGP09.phx.gbl...
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" <p.*******@bham.ac.uk> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...

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


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jason Callas | last post by:
I have a stored procedure that runs as a step in a scheduled job. For some reason the job does not seem to finish when ran from the job but does fine when run from a window in SQL Query. I know...
5
by: Ritesh | last post by:
Hi All, According to my observation using SP_WHO2 in my database, some INSERT statements are getting blocked by SELECT statements. Though the blocking SELECT statement is having ReadPast hint,...
4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
4
by: Bradley Burton | last post by:
I'm using Allen Brown's code for audit logging (http://allenbrowne.com/AppAudit.html), but I'm having a problem. My aud table doesn't populate with the tracking info at all. I think it might be a...
3
by: alexmaster_2004 | last post by:
hi i have made an application using C# that access sql2000. this application is just used to insert data to the database. i use something like this in my code: // string colmnA = TextBox1.Text;...
9
by: Jack | last post by:
Hi, I am gathering the input values to a form using Request.form method from the processing page. After all the data is captured, I am building sql statement out of it. Using a response.write...
2
by: mob1012 via DBMonster.com | last post by:
Hi All, I wrote last week about a trigger problem I was having. I want a trigger to produce a unique id to be used as a primary key for my table. I used the advice I received, but the trigger is...
22
by: b_r | last post by:
Hi, I'm trying to make a simple operation (insert into DB) in VB 2005 and SQL Server. The code is as follows: Dim sConnectionString As String = _ "Data...
8
by: Red | last post by:
If auto-format is turned off in VS2008, there is apparently no way to indent a line. Under Tools->Options->Text Editor->C#->Formatting, there are three checkboxes. Unchecking those seems to cause...
1
by: Maklar60 | last post by:
I am attempting to execute an INSERT statement on my page but continually get the following error: Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Incorrect syntax near '<'. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.