Hey guys,
I want to be able to insert data into text boxes and when i press the button store to be able to store the data into the database.
Does anyone know the code to do this?
Below is the code I have used so far, I know its close to the solution but Im not sure:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
"
Dim myOleDbConnection As OleDb.OleDbConnection
Dim insertcommand As String
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database.mdb;Persist Security Info=False"
insertcommand = "INSERT INTO Reservations (Transaction_Id, Item_Id, User_Id,Current_Date, Reserved_Until, Contact_Name, Contact_Tel)VALUES ('202-MV174', '8596586', '90803', '20/30/2003', '28/30/2003', 'Peter', '07719072955')"
myOleDbConnection = New OleDb.OleDbConnection(connString)
Dim myOleDbCommand As New OleDb.OleDbCommand(insertcommand, myOleDbConnection)
myOleDbConnection.Open()
Dim temp_num As Integer
Try
temp_num = myOleDbCommand.ExecuteNonQuery
Catch ex As Exception
Trace.WriteLine(ex.ToString)
End Try
myOleDbConnection.Close()
End Sub"
Thankyou all for your time