Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hii

i wish to ask

is it possible to do data searching using OleDbConnection

this means like recordset(rs.MoveNext or MovePrevious)

please tell me whether is it possible?

can please provide e with sample coding or any link that might provide the same info

thank you in advance

p.s tell me if this thing will not work...

Posted
hii

i wish to ask

is it possible to do data searching using OleDbConnection

this means like recordset(rs.MoveNext or MovePrevious)

please tell me whether is it possible?

can please provide e with sample coding or any link that might provide the same info

thank you in advance

p.s tell me if this thing will not work...

you can interop the ADODB library and use the old ADO way of doing things, but this is not recommended, I recommend o'reilley's Programming ADO.Net and the ado.net cookbook.

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

  • Administrators
Posted

You could always use a CurrencyManager for this kind of thing.

Try this - create a new form and add two text boxes and two labels (you can work out the names from the code below)

and then paste the following into the forms code (the declarations section should do it).

Private conn As New SqlClient.SqlConnection("Data source=localhost;Initial Catalog=Northwind;Integrated Security=true")
   Private cm As CurrencyManager
   Private dt As New DataTable

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       conn.Open()
       Dim da As New SqlClient.SqlDataAdapter("SELECT * FROM Employees", conn)
       da.Fill(dt)

       TextBox1.DataBindings.Add("Text", dt, "FirstName")
       TextBox2.DataBindings.Add("Text", dt, "LastName")
       cm = DirectCast(Me.BindingContext(dt), CurrencyManager)


   End Sub

   Private Sub btnMoveNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMoveNext.Click
       If cm.Position = cm.Count - 1 Then
           MessageBox.Show("You're at end of the records")
       Else
           cm.Position += 1
       End If
   End Sub

   Private Sub btnMovePrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMovePrevious.Click
       If cm.Position = 0 Then
           MessageBox.Show("You're at the beginning of the records.")
       Else
           cm.Position -= 1
       End If

   End Sub

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

thanks the coding work as the example given

i'll try to alter it so it fit to my coding

i have 1 question

for this coding below

Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Gary_Koh\Desktop\VB.Net\bin\cinema.mdb")

can i know how to make it to App.Path way?

thank you

  • *Experts*
Posted

Try Environment.CurrentDirectory (or something close to that).

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

im sorry Joe but can you be more specify on how to use the way that you intro to me?

im not very sure where and how to put it

i try a few time and all got errors

thank you

Posted
im sorry Joe but can you be more specify on how to use the way that you intro to me?

im not very sure where and how to put it

i try a few time and all got errors

thank you

reference msado15.dll

 

look at the samples here

 

<SDK>v1.1\Samples\Technologies\Interop\Basic\ASPXToADO

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

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...