Hello everyone.
I googled a lot about this but results didn't help.
However, I was able to read records from the database witht the following codes that google gave me.
I was trying to do the following way.
And it returned "DATA TYPE MISMATCH in expression criteria".
I'm a PHP MySQL programmer. So, I'm not really sure if my query string is correct.
I googled a lot about this but results didn't help.
However, I was able to read records from the database witht the following codes that google gave me.
Code:
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim rows As OleDbDataReader
con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\res\database.accdb; Persist Security Info=false;")
con.Open()
cmd = New OleDbCommand("SELECT * FROM EmployeeDetails", con)
rows = cmd.ExecuteReader()
Code:
Try
Dim con As OleDbConnection
Dim cmd As OleDbCommand
con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\res\database.accdb; Persist Security Info=false;")
con.Open()
cmd = New OleDbCommand("INSERT INTO EmployeeDetails (empName, Gender, DOB, Address, ContactNo, Salary, JobTitle, DateJoined, Picture)" & _
"VALUES ('" & empName & "','" & empGender & "',#" & empDOB & "#,'" & empAddress & "'," & empContactNo & "," & empSalary & ",'" & empJobTitle & "',#" & empJoinDate & "#,'" & empPicture & "')", con)
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
End Try
I'm a PHP MySQL programmer. So, I'm not really sure if my query string is correct.