Inserting a REcord in the access database

abhan

New member
Joined
Mar 6, 2007
Messages
1
Programming Experience
Beginner
I am trying to insert a record in the database, but it throws the exception.

Its very urgent, kindly help
My code is:-
If TextBox4.Text = "" Or TextBox5.Text = "" Then

MsgBox("Enter all Fields")
Else

Dim connStr As New OleDb.OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = Performance.MDB")
Dim sqlStr As New OleDb.OleDbCommand("insert into Period1 values (a,b,c,d,m,f,g,h,i,j,k,l)", connStr)
Try
connStr.Open()
sqlStr.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show("Data Access Error.")
Finally
connStr.Close()
End Try
 
read the DW2 link in my signature (it wont solve your problem, it will show you how to do data access properly in .net 2.0)
 
Back
Top