Results 1 to 6 of 6

Thread: error

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    64

    error

    I am working on a web application in vb.net:
    Why am I getting “Operation must use an updateable querry” error message at the: da.update statement of the following sub:

    Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click

    DS.Tables("accounts").Rows(Pos).BeginEdit()
    DS.Tables("accounts").Rows(Pos)("ID") = txtID.Text
    DS.Tables("accounts").Rows(Pos)("Account_Name") = txtName.Text
    DS.Tables("accounts").Rows(Pos)("Account_Reference") = txtReference.Text
    DS.Tables("accounts").Rows(Pos)("SubID") = txtSub.Text
    DS.Tables("accounts").Rows(Pos).EndEdit()

    DA.Update(DS, "Accounts")

    End Sub

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    64

    more details.

    here are the sql statement I am using, are there any fault in them?

    '
    'OleDbInsertCommand1
    '
    Me.OleDbInsertCommand1.CommandText = "INSERT INTO Accounts(Account_Name, Account_Reference, ID, SubID) VALUES (@Name, @Ref, @ID, @Sub);"
    Me.OleDbInsertCommand1.Connection = Me.Cnn
    Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("@Name", System.Data.OleDb.OleDbType.VarWChar, 50, "Account_Name"))
    Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("@Reference", System.Data.OleDb.OleDbType.VarWChar, 12, "Account_Reference"))
    Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("@ID", System.Data.OleDb.OleDbType.VarWChar, 5, "ID"))
    Me.OleDbInsertCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("@SubID", System.Data.OleDb.OleDbType.VarWChar, 5, "SubID"))

    '
    'OleDbSelectCommand1
    '
    Me.OleDbSelectCommand1.CommandText = "SELECT Account_Name, Account_Reference, ID, [Key], SubID FROM Accounts"
    Me.OleDbSelectCommand1.Connection = Me.Cnn

    '
    'OleDbUpdateCommand1
    '
    Me.OleDbUpdateCommand1.CommandText = "UPDATE Accounts SET Account_Name = ?, Account_Reference = ?, ID = ?, SubID = ? WHERE ([Key] = ?) AND (Account_Name = ? OR ? IS NULL AND Account_Name IS NULL) AND (Account_Reference = ? OR ? IS NULL AND Account_Reference IS NULL) AND (ID = ? OR ? IS NULL AND ID IS NULL) AND (SubID = ? OR ? IS NULL AND SubID IS NULL)"
    Me.OleDbUpdateCommand1.Connection = Me.Cnn
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter ("Account_Name", System.Data.OleDb.OleDbType.VarWChar, 50, "Account_Name"))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Account_Reference", System.Data.OleDb.OleDbType.VarWChar, 12, "Account_Reference"))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("ID", System.Data.OleDb.OleDbType.VarWChar, 5, "ID"))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("SubID", System.Data.OleDb.OleDbType.VarWChar, 5, "SubID"))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter ("Original_Key", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, False, CType(10, Byte), CType(0, Byte), "Key", System.Data.DataRowVersion.Original, Nothing))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Account_Name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Account_Name", System.Data.DataRowVersion.Original, Nothing))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Account_Name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Account_Name", System.Data.DataRowVersion.Original, Nothing))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Account_Reference", System.Data.OleDb.OleDbType.VarWChar, 12, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Account_Reference", System.Data.DataRowVersion.Original, Nothing))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Account_Reference1", System.Data.OleDb.OleDbType.VarWChar, 12, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Account_Reference", System.Data.DataRowVersion.Original, Nothing))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ID", System.Data.OleDb.OleDbType.VarWChar, 5, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ID", System.Data.DataRowVersion.Original, Nothing))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_ID1", System.Data.OleDb.OleDbType.VarWChar, 5, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "ID", System.Data.DataRowVersion.Original, Nothing))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_SubID", System.Data.OleDb.OleDbType.VarWChar, 5, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "SubID", System.Data.DataRowVersion.Original, Nothing))
    Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_SubID1", System.Data.OleDb.OleDbType.VarWChar, 5, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "SubID", System.Data.DataRowVersion.Original, Nothing))

  3. #3
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089
    The ans. you do not have sufficient rights to update the database.
    or the folder sharing and permissions arent proper.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    64

    Who to?

    Hi,

    Thanks veryjohny for your reply, but where can I see and edit the rights to update the database?

  5. #5
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    The wwwroot folder for the virtual direcory of your project shd have permission for IWAM_MachineName and IUSR_MACHINENAME users full access rights....right click on the foldername in windows explorer - under security tab

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    64

    Thanks

    Hi VeryJohny,

    Thanks for your help, I could solve hte problem, I did what you said but not to the rppt directory, but to the subdirectory where my application is located.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width