Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am have the following code:

Dim Conn As OleDb.OleDbConnection
Dim sConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
	 System.Windows.Forms.Application.ExecutablePath & "\db.mdb"
Conn.ConnectionString = sConn
Conn.Open()

 

This I figured out on my own just playing with things. Seems like I have created a connection object, set the connection parameters and opened the connection. Now I can't for the life of me find how to create a recordset or query the database at all. These simple functions are what I really need right now, but also if anyone has a website (other then msdn, which has already confused me enough for a lifetime) that covers all these basics it would be greatly appreciated, thank you.

  • *Experts*
Posted

The next thing you need is the command that will be executed in the database, something like:

Dim dbCmd As New OleDb.OleDbCommand("command text goes here", Conn)

First the command that will be executed, like:

SELECT columnname FROM tablename

And then you provide the connection that will be used.

The next thing you have to do is execute the command. If the command returns results (like the one I showed above) you use the ExecuteReader class to get the data to the OldDBDataReader. If you query doesnt return anything, like a querty that inserts data then you execute the command with the ExecuteNonQuery method.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...