'Operation must be an updateable query' | | |
OK Folks, its not very often that I ask a question, but I think I'm missing
something and I just cant seem to see it, Im very tired so some help would
be appreciated.
I have a webform with a DataGrid on it. In the DataGrid1.UpdateCommand, I am
setting a very simple update command
"UPDATE tblUsers SET FirstName='Manuel' WHERE UserID=1"
Now, I have tried the same technique from a windows forms application and
it works fine, why might I be getting this Exception
'Operation must be an updateable query'
When I execute the UpdateCommand.ExecuteNonQuery
I hate asking for help, but when your working on your own for hours on end,
sometimes it helps to talk to another !
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
Time flies when you don't know what you're doing | | | | re: 'Operation must be an updateable query'
If executing against an Access database, perhaps a permissions error for the
ASP.NET user for the .mdb file? (I usually put access files in their own
subfolder and give ASP.NET modify rights to folder. That way the .ldb file
can be created)
Just a guess,
Greg
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:u1KM2V4XEHA.2844@TK2MSFTNGP12.phx.gbl...[color=blue]
> OK Folks, its not very often that I ask a question, but I think I'm[/color]
missing[color=blue]
> something and I just cant seem to see it, Im very tired so some help would
> be appreciated.
>
> I have a webform with a DataGrid on it. In the DataGrid1.UpdateCommand, I[/color]
am[color=blue]
> setting a very simple update command
>
> "UPDATE tblUsers SET FirstName='Manuel' WHERE UserID=1"
>
> Now, I have tried the same technique from a windows forms application and
> it works fine, why might I be getting this Exception
>
>
> 'Operation must be an updateable query'
>
> When I execute the UpdateCommand.ExecuteNonQuery
>
> I hate asking for help, but when your working on your own for hours on[/color]
end,[color=blue]
> sometimes it helps to talk to another !
>
>
>
>
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
> Time flies when you don't know what you're doing
>
>[/color] | | | | re: 'Operation must be an updateable query'
Maybe if you post the relevant code we will spot something there.
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:u1KM2V4XEHA.2844@TK2MSFTNGP12.phx.gbl...[color=blue]
> OK Folks, its not very often that I ask a question, but I think I'm[/color]
missing[color=blue]
> something and I just cant seem to see it, Im very tired so some help would
> be appreciated.
>
> I have a webform with a DataGrid on it. In the DataGrid1.UpdateCommand, I[/color]
am[color=blue]
> setting a very simple update command
>
> "UPDATE tblUsers SET FirstName='Manuel' WHERE UserID=1"
>
> Now, I have tried the same technique from a windows forms application and
> it works fine, why might I be getting this Exception
>
>
> 'Operation must be an updateable query'
>
> When I execute the UpdateCommand.ExecuteNonQuery
>
> I hate asking for help, but when your working on your own for hours on[/color]
end,[color=blue]
> sometimes it helps to talk to another !
>
>
>
>
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
> Time flies when you don't know what you're doing
>
>[/color] | | | | re: 'Operation must be an updateable query'
Hi Terry,
I made a complete test with every on it even a datagrid, an insert, a
datareader and your update.
No problems at all even with exactly the same text as you.
So as Mariana said show some code, (when you want it, you see my email
adres, however tomorrow I have almost no time)
Cor | | | | re: 'Operation must be an updateable query'
I'm givin up for tonight. . . Here's the code.
Cheers
Public Class WebForm1
Inherits System.Web.UI.Page
Private Con As New System.Data.OleDb.OleDbConnection("Data
Source=C:\ASPNET\Banking.mdb;Provider=Microsoft.Je t.OLEDB.4.0;")
Private SelectCommand As New System.Data.OleDb.OleDbCommand
Private UpdateCommand As New System.Data.OleDb.OleDbCommand
Private DS1 As New DS
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Private DA As New System.Data.OleDb.OleDbDataAdapter
Private Sub FillDataSet()
'Select Command
SelectCommand.CommandText = "SELECT * FROM tblUsers"
SelectCommand.Connection = Con
DA.SelectCommand = SelectCommand
DataGrid1.DataSource = DS1.Tables("tblUsers")
Try
Con.Open()
DS1.Clear()
DA.Fill(DS1, "tblUsers")
DataGrid1.DataBind()
Catch ex As Exception
Label1.Text = ex.Message
Finally
Con.Close()
End Try
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then Me.FillDataSet()
End Sub
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.EditCommand
Label1.Text = "Im in Edit"
Me.FillDataSet()
DataGrid1.EditItemIndex = e.Item.ItemIndex
DataGrid1.DataBind()
End Sub
Private Sub DataGrid1_DeleteCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.DeleteCommand
Label1.Text = "Im in Delete"
End Sub
Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.UpdateCommand
Label1.Text = "I'm In Update"
Dim UpdateCommand As New System.Data.OleDb.OleDbCommand
DA.UpdateCommand = UpdateCommand
Try
Con.Open()
UpdateCommand.Connection = Con
UpdateCommand.CommandText = "UPDATE tblUsers SET
FirstName='GARY' WHERE UserID=1"
'DA.Update(DS1, "tblUSers")
Label1.Text = UpdateCommand.ExecuteNonQuery
'^^^^^^^^ FAILS HERE ^^^^^^^^^^^
DataGrid1.EditItemIndex = -1
Me.FillDataSet()
'At End
'DataGrid1.EditItemIndex = -1
DataGrid1.DataBind()
Catch ex As Exception
Label1.Text = ex.Message
Finally
Con.Close()
End Try
End Sub
End Class
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
Time flies when you don't know what you're doing
"Cor Ligthert" <notfirstname@planet.nl> wrote in message
news:%232$AUD5XEHA.2908@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hi Terry,
>
> I made a complete test with every on it even a datagrid, an insert, a
> datareader and your update.
> No problems at all even with exactly the same text as you.
>
> So as Mariana said show some code, (when you want it, you see my email
> adres, however tomorrow I have almost no time)
>
> Cor
>
>[/color] | | | | re: 'Operation must be an updateable query'
I can't see anything obviously wrong, so I would then go with what Greg
suggested, which is that ASP.NET does not have sufficient rights to modify
that file. Make sure that it does.
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:ebj44t5XEHA.3644@TK2MSFTNGP12.phx.gbl...[color=blue]
> I'm givin up for tonight. . . Here's the code.
>
> Cheers
>
> Public Class WebForm1
> Inherits System.Web.UI.Page
>
> Private Con As New System.Data.OleDb.OleDbConnection("Data
> Source=C:\ASPNET\Banking.mdb;Provider=Microsoft.Je t.OLEDB.4.0;")
> Private SelectCommand As New System.Data.OleDb.OleDbCommand
> Private UpdateCommand As New System.Data.OleDb.OleDbCommand
> Private DS1 As New DS
> Protected WithEvents Label1 As System.Web.UI.WebControls.Label
> Private DA As New System.Data.OleDb.OleDbDataAdapter
>
> Private Sub FillDataSet()
>
> 'Select Command
> SelectCommand.CommandText = "SELECT * FROM tblUsers"
> SelectCommand.Connection = Con
>
> DA.SelectCommand = SelectCommand
> DataGrid1.DataSource = DS1.Tables("tblUsers")
>
> Try
> Con.Open()
> DS1.Clear()
> DA.Fill(DS1, "tblUsers")
> DataGrid1.DataBind()
> Catch ex As Exception
> Label1.Text = ex.Message
> Finally
> Con.Close()
> End Try
>
>
> End Sub
>
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
> If Not Page.IsPostBack Then Me.FillDataSet()
>
> End Sub
> #Region " Web Form Designer Generated Code "
>
> 'This call is required by the Web Form Designer.
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
> InitializeComponent()
>
> End Sub
> Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
>
> 'NOTE: The following placeholder declaration is required by the Web[/color]
Form[color=blue]
> Designer.
> 'Do not delete or move it.
> Private designerPlaceholderDeclaration As System.Object
>
> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Init
> 'CODEGEN: This method call is required by the Web Form Designer
> 'Do not modify it using the code editor.
> InitializeComponent()
> End Sub
>
> #End Region
>
> Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
> DataGrid1.EditCommand
> Label1.Text = "Im in Edit"
> Me.FillDataSet()
> DataGrid1.EditItemIndex = e.Item.ItemIndex
> DataGrid1.DataBind()
>
> End Sub
>
> Private Sub DataGrid1_DeleteCommand(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
> DataGrid1.DeleteCommand
> Label1.Text = "Im in Delete"
> End Sub
>
> Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
> DataGrid1.UpdateCommand
> Label1.Text = "I'm In Update"
>
> Dim UpdateCommand As New System.Data.OleDb.OleDbCommand
>
>
> DA.UpdateCommand = UpdateCommand
>
> Try
> Con.Open()
> UpdateCommand.Connection = Con
> UpdateCommand.CommandText = "UPDATE tblUsers SET
> FirstName='GARY' WHERE UserID=1"
> 'DA.Update(DS1, "tblUSers")
>
> Label1.Text = UpdateCommand.ExecuteNonQuery
> '^^^^^^^^ FAILS HERE ^^^^^^^^^^^
> DataGrid1.EditItemIndex = -1
> Me.FillDataSet()
>
> 'At End
> 'DataGrid1.EditItemIndex = -1
> DataGrid1.DataBind()
> Catch ex As Exception
> Label1.Text = ex.Message
> Finally
> Con.Close()
> End Try
> End Sub
> End Class
>
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
> Time flies when you don't know what you're doing
>
> "Cor Ligthert" <notfirstname@planet.nl> wrote in message
> news:%232$AUD5XEHA.2908@TK2MSFTNGP10.phx.gbl...[color=green]
> > Hi Terry,
> >
> > I made a complete test with every on it even a datagrid, an insert, a
> > datareader and your update.
> > No problems at all even with exactly the same text as you.
> >
> > So as Mariana said show some code, (when you want it, you see my email
> > adres, however tomorrow I have almost no time)
> >
> > Cor
> >
> >[/color]
>
>[/color] | | | | re: 'Operation must be an updateable query'
Yep, that was it. Permissions are a little bit more convoluted to do on XP
because by default simple file sharing is switched on.
Fixed - Thanks everyone
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
Time flies when you don't know what you're doing
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:u1KM2V4XEHA.2844@TK2MSFTNGP12.phx.gbl...[color=blue]
> OK Folks, its not very often that I ask a question, but I think I'm[/color]
missing[color=blue]
> something and I just cant seem to see it, Im very tired so some help would
> be appreciated.
>
> I have a webform with a DataGrid on it. In the DataGrid1.UpdateCommand, I[/color]
am[color=blue]
> setting a very simple update command
>
> "UPDATE tblUsers SET FirstName='Manuel' WHERE UserID=1"
>
> Now, I have tried the same technique from a windows forms application and
> it works fine, why might I be getting this Exception
>
>
> 'Operation must be an updateable query'
>
> When I execute the UpdateCommand.ExecuteNonQuery
>
> I hate asking for help, but when your working on your own for hours on[/color]
end,[color=blue]
> sometimes it helps to talk to another !
>
>
>
>
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
> Time flies when you don't know what you're doing
>
>[/color] |  | Similar Visual Basic .NET bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,510 network members.
|