kiranboi
asked on
Writing Data into Access Using ADO.Net
Hi All,
Im using ADO.Net in my app to read data from an Access database. I'm OK doing this but I'm unsure how to write data back into Access with ADO.Net as I am used to using ADOdb.
Can someone give me a quick example.
Thanks
Im using ADO.Net in my app to read data from an Access database. I'm OK doing this but I'm unsure how to write data back into Access with ADO.Net as I am used to using ADOdb.
Can someone give me a quick example.
Thanks
ASKER
just out of interest, is there any way of doing it without using SQL?
ASKER
can you show me an example of updating a record and one of creating a new record and deleteing one
thanks
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Public myConnection As OleDbConnection
Public ConnStr As String = "PROVIDER=Microsoft.Jet.OL
then in the webform import this
Imports System.Data.OleDb
on the insert button click put this
Try
Dim SQL As String
Dim comm As OleDbCommand
myConnection = New OleDbConnection(ConnStr)
myConnection.Open()
SQL = "insert into tblNewsletter (emailid, createdon) values ('" & somveVar & "','" & Now & "')"
comm = New OleDbCommand(SQL, myConnection)
comm.ExecuteNonQuery()
myConnection.Close()
Catch ex As Exception
'Response.Write(ex.Message
End Try