|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem with Insert statement...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 > I'm not sure whether this is because the connection isn't allowing updates Most likely neither. In all probability the user account under which ASP.Net > or whether there's something odd about the insert statement. 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. -- Show quoteHide quoteHTH, Kevin Spencer Microsoft MVP ..Net Developer Ambiguity has a certain quality to it. "Paul Mason" <p.maso***@bham.ac.uk> wrote in message news:uDL9eV3aFHA.2520@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 > > > I don't believe it....arghhhhhhh!!
Thanks, that works fine now....P Show quoteHide quote "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in message news:ewmXGH4aFHA.2876@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.maso***@bham.ac.uk> wrote in message > news:uDL9eV3aFHA.2520@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 >> >> >> > >
Other interesting topics
|
|||||||||||||||||||||||