Click here to Skip to main content
11,706,979 members (54,396 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Access VB.NET Help
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
try
    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")
 
    Label7.DataBindings.Add("Text",
    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)
    count()
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
    BindingSource1.EndEdit()
    DataAdapter1.Update(DataSet1, "DataTable1 ")
    count()
Posted 27-Mar-13 14:26pm
monemdb720
Edited 27-Mar-13 14:55pm
v2
Comments
ThePhantomUpvoter at 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
good
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.
  Permalink  
Comments
monemdb at 28-Mar-13 20:53pm
   
monem
the proplem stil happen plesa any solution about repair this code
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

monem

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

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 205
1 OriginalGriff 125
2 chainerlt 110
3 ppolymorphe 89
4 Maciej Los 80
0 OriginalGriff 9,178
1 Sergey Alexandrovich Kryukov 8,512
2 CPallini 5,189
3 Maciej Los 4,766
4 Mika Wendelius 3,696


Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 28 Mar 2013
Copyright © CodeProject, 1999-2015
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