Click here to Skip to main content
13,554,805 members
Rate this:
Please Sign up or sign in to vote.
See more:
im making tow table where ineer join connect awanted to save and update an iwanted to change in my program and update it this is my cod to connect
    cmd.CommandText = "SELECT Employee.Emp_ID ,Employee.Emp_Name ,Employee.Emp_Tel , Dep_Name FROM Employee , Department where Employee.Dep_id = Department.Dep_id "

    DataAdapter1 = New OleDbDataAdapter(cmd)
    Dim builder As New OleDbCommandBuilder(DataAdapter1)

    DataSet1 = New DataSet()

    'Load some data into the DGV
    DataAdapter1.Fill(DataSet1, "DataTable1")
    BindingSource1 = New BindingSource(DataSet1, "DataTable1")
    BindingSource2 = New BindingSource(DataSet1, "DataTable1")

    BindingSource1, "Emp_ID", True, 1, "")

    TextBox1.DataBindings.Add("Text", BindingSource1, "Emp_Name", True, 1, "")
    TextBox2.DataBindings.Add("Text", BindingSource1, "Emp_Tel", True, 1, "")
    TextBox3.DataBindings.Add("Text", BindingSource1, "Dep_Name", True, 1, "")
    ' TextBox4.DataBindings.Add("Text", BindingSource1, "price", True, 1, "")
    ' TextBox5.DataBindings.Add("Text", BindingSource1, "total", True, 1, "")

    DataGridView1.DataSource = BindingSource1
    ComboBox1.DataSource = BindingSource1
    ComboBox1.DisplayMember = "Emp_Name"
    ComboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend
    ComboBox1.AutoCompleteSource = AutoCompleteSource.ListItems

    DataGridView1.Columns(0).Width = 40
    DataGridView1.Columns(1).Width = 100
    DataGridView1.Columns(2).Width = 70
    DataGridView1.Columns(3).Width = 70
    ' DataGridView1.Columns(4).Width = 70
    ' DataGridView1.Columns(5).Width = 100

    DataGridView1.Columns(0).HeaderText = "?????"
    DataGridView1.Columns(1).HeaderText = "?????"
    DataGridView1.Columns(2).HeaderText = "??????"
    DataGridView1.Columns(3).HeaderText = "??????"
    ' DataGridView1.Columns(4).HeaderText = "?????"
    ' DataGridView1.Columns(5).HeaderText = "????????"

    DataGridView1.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
    DataGridView1.Columns(0).ReadOnly = True
    DataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
    DataGridView1.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
    DataGridView1.Sort(DataGridView1.Columns(1), System.ComponentModel.ListSortDirection.Ascending)
Catch ex As Exception
    MessageBox.Show(ex.Message, "?????", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

and this code make proplem to update tow taple

buton _click
If BindingSource1.Count = 0 Then Beep() : Exit Sub
    DataAdapter1.Update(DataSet1, "DataTable1 ")
Posted 27-Mar-13 14:26pm
Updated 27-Mar-13 14:55pm
NotPolitcallyCorrect 27-Mar-13 20:37pm
If there was some sort of a question or description of a problem anywhere in there, I sure missed it.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

DataAdapter1.Update(DataSet1, "DataTable1 ")
The above statement is wrong. DataTable1 has a space in it. You dont have to call the table part.
You can just say Adapter.Update(DataSet).

Other reasons can be found out only if you have posted how you have provided your updation queries.
monemdb 28-Mar-13 20:53pm
the proplem stil happen plesa any solution about repair this code
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


the prpplem was stil error and dont save any thing plese any one to help me to solve this proplem

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180515.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100