aspdotnet_website_programming thread: Insert record ,raise Error in Access2000('Operation must use Updateable Query)
Message #1 by antony66@h... on Tue, 5 Nov 2002 17:26:34
|
|
Sub MyDataGrid_Update(sender As Object, e As DataGridCommandEventArgs)
Dim Ds as New DataSet()
Dim Insert_SQL As String = "Insert into tParent ( namcod,
Client_code, systemID) values (?,?,?)"
Dim Select_SQL As String = "Select Parent_Key,namcod, Client_code,
systemID from tParent"
Dim Da As New OleDbDataAdapter(Select_SQL,Cnn)
Da.InsertCommand = New OleDbCommand(Insert_SQL,Cnn)
Da.InsertCommand.CommandType = CommandType.Text
Da.InsertCommand.Parameters.Add("@namcod",OleDbType.Char,60,"namcod")
Da.InsertCommand.Parameters.Add
("@Client_code",OleDbType.Char,5,"Client_code")
Da.InsertCommand.Parameters.Add
("@systemID",OleDbType.Integer,0,"systemID")
Cnn.Open()
Da.FillSchema(Ds,SchemaType.Mapped)
Da.Fill(Ds,"Client")
' Add new row to table 'Client'
Dim newRow As DataRow = Ds.Tables("Client").NewRow()
newRow("namcod") = "XX"
newRow("Client_code") = "YY"
newRow("systemID") = 999
Ds.Tables("Client").Rows.Add(newRow)
Try
Da.Update(Ds, "Client")
Catch Exc As OledbException
Dim i As Integer
For i = 0 To Exc.Errors.Count - 1
myMessage.text = "Message:" & Exc.Errors(i).Message
& "<br>Native:" & Exc.Errors(i).NativeError.ToString()
& "<br>Source: " + Exc.Errors(i).Source & "<br>SQL: " + Exc.Errors
(i).SQLState
Next i
End Try
Cnn.Close()
End Sub
Error Displayed: 'Operation must use Updateable Query'
Message #2 by dougwood@a... on Fri, 8 Nov 2002 03:31:06
|
|
This may seem obvious , but did you check to make sure that your DB is NOT
Read-Only ?
Right click the .mdb file > Properties > and check that Read Only is
unchecked.
Message #3 by "Ken Schaefer" <ken@a...> on Fri, 8 Nov 2002 18:08:57 +1100
|
|
Check NTFS permissions for the IUSR_<machinename> account. Try changing it
to Change (RWXD) for the folder that the file is in (and the file itself).
If that makes the problem go away, then you can tighten the permissions
slightly.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <antony66@h...>
Updateable Query)
: Sub MyDataGrid_Update(sender As Object, e As DataGridCommandEventArgs)
: Dim Ds as New DataSet()
: Dim Insert_SQL As String = "Insert into tParent ( namcod,
: Client_code, systemID) values (?,?,?)"
: Dim Select_SQL As String = "Select Parent_Key,namcod, Client_code,
: systemID from tParent"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|