Here is a little tutorial.
First setup your Database connection.
Put the next bit of code in your Form's Public class
Dim dbInsert As New OleDb.OleDbCommand Dim dbConnect As New OleDb.OleDbConnection
Put the next bit of code in your Form Load Private Sub
Try dbConnect.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Database\Main.mdb" dbConnect.Open() Catch ex As Exception MessageBox.Show(ex.Message) Me.Close() End Try
Lets say you have 3 text boxes txtName, txtSurname & txtNumber and you want to update the database with the data in the boxes, put the following code in the update button click event Private Sub.
*NOTE: col_Name, col_Surname, col_Number are your column names in your database.
dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "col_Name" dbInsert.Parameters.Item("col_Name").Value = txtName.Text dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "col_Surname" dbInsert.Parameters.Item("col_Surname").Value = txtSurname.Text dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "col_Number" dbInsert.Parameters.Item("col_Number").Value = txtNumber.Text
*NOTE: Table_Person is your table in the database.
dbInsert.CommandText = "INSERT INTO Table_Person VALUES (txtName.Text, txtSurname.Text, txtNumber.Text);" dbInsert.CommandType = CommandType.Text dbInsert.Connection = dbConnect dbInsert.ExecuteNonQuery() dbConnect.Close()
Edited 6 Years Ago by Animal Mother: n/a
Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...
Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.
This is the result of previous question answered :
code for the listbox - datagridview interaction
At the top of the code ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...