VB.Net and Ado.Net Help Please!!!! 
Author Message
 VB.Net and Ado.Net Help Please!!!!

Is there any tutorial available that gives you  a step by step of how to use
all the new ado.net components so I can connect to a access database
programmatically and populate it with data similar to the following:

Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset

Conn.Open ConnectString

'Rs.CursorType = adOpenStatic
'Rs.CursorLocation = adUseServer
Rs.Open "select * from ascgroupcodes", Conn, _
adOpenStatic, adLockPessimistic, adCmdText

Rs.AddNew

Rs.Fields("cptcode").Value = cptcode
Rs.Fields("ascgroupercode").Value = ascgroupercode

Rs.Update

Is there something in the project references I need to do or is there a way
I can do this in ADo.net ? I would prefer to be able to do this in ADO.net
objects.

Thanks....



Tue, 14 Dec 2004 02:31:03 GMT  
 VB.Net and Ado.Net Help Please!!!!
Alan -
Here's an article that explains how to connect to an access db.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q308278
Once you establish your connection most of the walkthroughs in the
documentation should help you .
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbco...
vboridatawalkthroughs.asp

Hope this helps -
Sunder & Steve
VB .NET

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:

> Is there any tutorial available that gives you  a step by step of how to
use
> all the new ado.net components so I can connect to a access database
> programmatically and populate it with data similar to the following:

> Dim Conn As New ADODB.Connection
> Dim Rs As New ADODB.Recordset

> Conn.Open ConnectString

> 'Rs.CursorType = adOpenStatic
> 'Rs.CursorLocation = adUseServer
> Rs.Open "select * from ascgroupcodes", Conn, _
> adOpenStatic, adLockPessimistic, adCmdText

> Rs.AddNew

> Rs.Fields("cptcode").Value = cptcode
> Rs.Fields("ascgroupercode").Value = ascgroupercode

> Rs.Update

> Is there something in the project references I need to do or is there a
way
> I can do this in ADo.net ? I would prefer to be able to do this in ADO.net
> objects.

> Thanks....



Tue, 14 Dec 2004 03:36:40 GMT  
 VB.Net and Ado.Net Help Please!!!!
Alan,
    Here is some code.
Public Sub ReadMyData(myConnString As String)
    Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders"
    Dim myConnection As New SqlConnection(myConnString)
    Dim myCommand As New SqlCommand(mySelectQuery, myConnection)
    myConnection.Open()
    Dim myReader As SqlDataReader
    myReader = myCommand.ExecuteReader()
    ' Always call Read before accessing data.
    While myReader.Read()
        Console.WriteLine((myReader.GetInt32(0) & ", " &
myReader.GetString(1)))
    End While
    ' always call Close when done reading.
    myReader.Close()
    ' Close the connection when done with it.
    myConnection.Close()
End Sub 'ReadMyData

[C#]
public void ReadMyData(string myConnString) {
    string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders";
    SqlConnection myConnection = new SqlConnection(myConnString);
    SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection);
    myConnection.Open();
    SqlDataReader myReader;
    myReader = myCommand.ExecuteReader();
    // Always call Read before accessing data.
    while (myReader.Read()) {
       Console.WriteLine(myReader.GetInt32(0) + ", " +
myReader.GetString(1));
    }
    // always call Close when done reading.
    myReader.Close();
    // Close the connection when done with it.
    myConnection.Close();
 }

Good luck,
    Eric Ritzie, MCP
    IT Manager - The Kramer Group, Inc.

Quote:

> Is there any tutorial available that gives you  a step by step of how to
use
> all the new ado.net components so I can connect to a access database
> programmatically and populate it with data similar to the following:

> Dim Conn As New ADODB.Connection
> Dim Rs As New ADODB.Recordset

> Conn.Open ConnectString

> 'Rs.CursorType = adOpenStatic
> 'Rs.CursorLocation = adUseServer
> Rs.Open "select * from ascgroupcodes", Conn, _
> adOpenStatic, adLockPessimistic, adCmdText

> Rs.AddNew

> Rs.Fields("cptcode").Value = cptcode
> Rs.Fields("ascgroupercode").Value = ascgroupercode

> Rs.Update

> Is there something in the project references I need to do or is there a
way
> I can do this in ADo.net ? I would prefer to be able to do this in ADO.net
> objects.

> Thanks....



Tue, 14 Dec 2004 03:57:37 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ADO.NET with ASP.NET using VB.NET

2. Using ADO (not ADO.net) in VB.NET - PLEASE PLEASE PLEASE HELP !!!

3. ADO.Net to fetch ActiveDirectory this function bugs in Asp.net but works in Vb.n

4. Visual Basic .NET and ADO.NET code - Disconnected Updating Help

5. what create table using ADO.NET to VB.NET

6. VB.Net, Classes and ADO.Net guidelines???

7. VB.Net => Ado.Net = Stored Procedure

8. Memory leak! (ADO.NET, VB.NET)

9. vb.net / ado.net design question

10. ADO.net VB.net and Oracle

11. Dummies guide to ado.net for vb.net???

12. Newbie question (ado.net / vb.net)

 

 
Powered by phpBB® Forum Software