basic question inserting data into a table
-
Ok, I know vb.net and I've used ms access before and I understand the basic concepts of what a recordset and cursor and other stuff are but I have never used ADO before to program a database and I need to learn. Specifically I am trying to use vb.net 2005 to program ms access 2007. I've opened the database and opened a recordset successfully. This is the code I used.
Private ADOConnection As New ADODB.Connection 'the database Private rsGuest As New ADODB.Recordset 'the recordset 'code for opening the database and recordset ADOConnection.Open("provider=microsoft.ace.oledb.12.0;" & "Data Source=j:\junk.accdb") rsGuest.Open("Guest", ADOConnection, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
What I need to know is what is the syntax for adding data to a recordset. If someone could give me an example it would be very helpfull. Thanks in advance. Mike ps I have googled the hell out of this but every example I find is either a different version of access or vb, or is an example of using sql server, or it is an example of vba within access. In any case there seem to subtle incompatabilities that mean the examples never seem to work. -
Ok, I know vb.net and I've used ms access before and I understand the basic concepts of what a recordset and cursor and other stuff are but I have never used ADO before to program a database and I need to learn. Specifically I am trying to use vb.net 2005 to program ms access 2007. I've opened the database and opened a recordset successfully. This is the code I used.
Private ADOConnection As New ADODB.Connection 'the database Private rsGuest As New ADODB.Recordset 'the recordset 'code for opening the database and recordset ADOConnection.Open("provider=microsoft.ace.oledb.12.0;" & "Data Source=j:\junk.accdb") rsGuest.Open("Guest", ADOConnection, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
What I need to know is what is the syntax for adding data to a recordset. If someone could give me an example it would be very helpfull. Thanks in advance. Mike ps I have googled the hell out of this but every example I find is either a different version of access or vb, or is an example of using sql server, or it is an example of vba within access. In any case there seem to subtle incompatabilities that mean the examples never seem to work. -
Ok, I know vb.net and I've used ms access before and I understand the basic concepts of what a recordset and cursor and other stuff are but I have never used ADO before to program a database and I need to learn. Specifically I am trying to use vb.net 2005 to program ms access 2007. I've opened the database and opened a recordset successfully. This is the code I used.
Private ADOConnection As New ADODB.Connection 'the database Private rsGuest As New ADODB.Recordset 'the recordset 'code for opening the database and recordset ADOConnection.Open("provider=microsoft.ace.oledb.12.0;" & "Data Source=j:\junk.accdb") rsGuest.Open("Guest", ADOConnection, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
What I need to know is what is the syntax for adding data to a recordset. If someone could give me an example it would be very helpfull. Thanks in advance. Mike ps I have googled the hell out of this but every example I find is either a different version of access or vb, or is an example of using sql server, or it is an example of vba within access. In any case there seem to subtle incompatabilities that mean the examples never seem to work.You really shouldn't be using ADODB from VB.Net. ADODB is an older COM technology and was replaced in .Net with the System.Data.Oledb namespace classes. Oledb uses Datasets, Datatables, DataReaders and DataAdapters rather than Recordsets. It performs better than ADODB and is easier to use, and is an integrated set of managed classes.