Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi...
I have a program (vb.net) related with access 2007 database when I finished it and debug.it works normaly(add ,edit ,and delete)but when I finished make a setup with Inno Setup Compiler for it and try (add,edit and delet) I have more error message
such When i try add and edit the message error is (operation must use an updateable quary).when i try delet the messag error is(coud not delete from specified tables)
please help me.....
I'm sorry my English is weak
Posted
Comments
Sergey Alexandrovich Kryukov 28-Feb-12 16:51pm    
You English not a main problem. I hope the language of error messages and your code is more clear, but -- where is that? You don't tell us anything specific.
--SA
Michael Azzar 28-Feb-12 17:01pm    
thanks for you...
this is my first form code

Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim conStr As String = " Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\cunu.accdb"
Dim con As New OleDbConnection(conStr)
Sub Search() ' for searsh
Dim myQuery As String = ""

Dim sql As String = "select * from Table1 where ID=" & Val(TextBox7.Text) & ""
If con.State() Then con.Close()
con.Open()
Dim cmd As New OleDbCommand(sql, con)
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader()
If dr.Read() = True Then
TextBox7.Text = dr.Item(0).ToString
ComboBox1.Text = dr.Item(1).ToString
TextBox1.Text = dr.Item(2).ToString
TextBox2.Text = dr.Item(3).ToString
TextBox3.Text = dr.Item(4).ToString
TextBox4.Text = dr.Item(5).ToString
TextBox5.Text = dr.Item(6).ToString
TextBox6.Text = dr.Item(7).ToString
con.Close()
Else
con.Close()
TextBox7.Text = ""
ComboBox1.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
MessageBox.Show(" Sorry there is no ")

End If



End Sub
Sub View() ' show
Dim sql As String = "select * from Table1 order by ID"
If con.State() Then con.Close()


con.Open()
Dim da = New OleDbDataAdapter(sql, con)
Dim dt As New DataTable
da.Fill(dt)
Me.DataGridView1.DataSource = dt
con.Close()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'TODO: This line of code loads data into the 'CunuDataSet.Table1' table. You can move, or remove it, as needed.
Me.Table1TableAdapter.Fill(Me.CunuDataSet.Table1)
Me.View()

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql As String = "select max(id) as q from Table1"
Dim f As String = ""

If con.State() Then con.Close()
con.Open()
Dim cmd As New OleDbCommand(sql, con)
Try
f = cmd.ExecuteScalar().ToString()
TextBox7.Text = f + 1

Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
ComboBox1.Text = ""
TextBox1.Text = "0"
TextBox2.Text = "0"
TextBox3.Text = "0"
TextBox4.Text = "0"
TextBox5.Text = "0"
TextBox6.Text = "0"
End Sub

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
TextBox7.Text = DataGridView1.CurrentRow.Cells(0).Value.ToString()
ComboBox1.Text = DataGridView1.CurrentRow.Cells(1).Value.ToString()
TextBox1.Text = DataGridView1.CurrentRow.Cells(2).Value.ToString()
TextBox2.Text = DataGridView1.CurrentRow.Cells(3).Value.ToString()
TextBox3.Text = DataGridView1.CurrentRow.Cells(4).Value.ToString()
TextBox4.Text = DataGridView1.CurrentRow.Cells(5).Value.ToString()
TextBox5.Text = DataGridView1.CurrentRow.Cells(6).Value.ToString()
TextBox6.Text = DataGridView1.CurrentRow.Cells(7).Value.ToString()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim sql As String = "select * from Table1 where ID=" & Val(TextBox7.Text) & ""
If con.State() Then con.Close()
con.Open()
Dim cmd As New OleDbCommand(sql, con)
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader()
If dr.Read() = True Then

Tex
Michael Azzar 28-Feb-12 17:09pm    
sorry some of code lost when i paste it
Ganesan Senthilvel 28-Feb-12 23:42pm    
For better understanding, it needs to be formatted well

1 solution

Refer this Microsoft article http://support.microsoft.com/kb/175168[^] to resolve 'operation must use an updateable quary' issue
 
Share this answer
 
Comments
Michael Azzar 29-Feb-12 15:57pm    
thank you
mr: GanesanSenthilvel

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900