Data in DataTable bd cannot be updated
Good afternoon. Complete the datatabl values from the database. datatabl complete the values from the 2nd tables (used consolidated request). Datatable continues to change and these changes cannot be made to the base. There are no errors in the programme ' s work, but there is no update. Please tell me what the problem is. Datatable data
sqlConnection = New SqlClient.SqlConnection("Data Source = *; User id = *; Password = *; database=* ;Integrated Security = False;") sqlConnection.Open() commandStrEmployee = "SEL ECT e.id_correspondent, e.surname, d.title,d.id_duty fr om Employee e inner join Duty d on e.id_duty=d.id_duty" adapterEmployee = New SqlDataAdapter(commandStrEmployee, sqlConnection) adapterEmployee.Fill(dtEmployee)
Data entry into datatable
Dim a As DataRow = Form1.dtEmployee.Rows(i) a.BeginEdit() a("id_duty") = Form1.dt_duty.Rows(b)("id_duty") a("title") = Form1.dt_duty.Rows(b)("title") a.EndEdit() a.AcceptChanges()
Somehow the last line doesn't work.
Doing a similar C# program with textbox on the OBD. The code looks like VB, I think it'll help. There's a two-field discipline and publishing place.
string discipline = Convert.ToString(comboBox1.Text); string publishing = Convert.ToString(textBox6.Text);
cls.Conn.Open(); SqlCommand iCommand = cls.Conn.CreateCommand(); iCommand.CommandText = "INSERT INTO " + "Books (Дисциплины,
Publication) + VALUES (@discipline, @publishing)
SqlDbType.NChar, 100); iCommand.Parameters. Value = discipline;
SqlDbType.NChar, 30); iCommand.Parameters[@publishing]. Value = publishing;
In this case, cls is the main class of the annex and Conn is the variable connection to the database. They're described:
static public SqlConnection Conn;
Although you can put the last paragraph down. In your case, it would be easier to apply the OBD fields to the variable and put them in the OBD separate flow as shown in me.