Installation

rafi

Member
Joined
Aug 10, 2011
Messages
14
Programming Experience
Beginner
Hi i am new to vbdotnet forums . This is my:eek2: first post
i developed the vb.net appplication in Xp but i got the below error when i installed into windows 7 32bit


"Operation must use an updateable query" when i try to save the data

Does anyone know this error please help me


Thanks in Advance
 
vb.net

i have entered coding which i haave written in under update button
button_click.....
 TextBox2.Text = TextBox2.Text.Replace("'", "")
        TextBox4.Text = TextBox4.Text.Replace("'", "")
        Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & d_location & ";Jet OLEDB:Database Password=" & d_password)
        Dim cmd As New OleDbCommand

        Try
            If TextBox1.Text.Trim = "" Then
                MessageBox.Show("Please enter Material Code before update!", "Update", MessageBoxButtons.OK, MessageBoxIcon.Warning)

                Exit Sub
            End If


            con.Open()

            query = "Update addMaterial set mat_Name='" + TextBox2.Text + "',quantity='" + cbunit.Text + "' ,unit_rate='" + TextBox4.Text + "' where mat_No='" + TextBox1.Text + "'"
            cmd = New OleDbCommand(query, con)
            cmd.ExecuteNonQuery()
            MsgBox("Updated successfully")
            Dim intresponse As Integer
            intresponse = MessageBox.Show("Do You Want To Update Another record?", "Material Master", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
            If intresponse = MsgBoxResult.No Then


                Me.Close()

            Else
                clear()
                Panel1.Visible = True
                btnSave.Enabled = True

                btnEdit.Enabled = False
                Exit Sub

            End If
            clear()

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        con.Close()
 
Last edited by a moderator:
First up, don't use string concatenation to build SQL code. Always use parameters to insert variables into SQL code. Follow the Blog link in my signature and check out my post on ADO.NET Parameters to learn why and how. Amongst other things, that will negate the need to remove single quotes from your TextBoxes.

Once you've done that properly, I hope that your issue should go away, although that does seem like an odd error message to get under the circumstances. Let's take it one step at a time anyway. I say "properly" because you must also ensure that you are using the correct data types, which I suspect that you are not currently. You have a column named "quantity", which implies a number, and you are inserting text.
 
Vb.net

Sir really nice, If possible can you send me the basic insert and update coding because i am fresher and working in small concern. There is no one in vb.net development even no senior to correcting my mistakes. First i should learn code standard and procedures. Please sir guide me and my carrier starts from here.

Thank you
 
Back
Top