database access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

--
hello
I have VB.net standard.
I thought this version has no data access but I have data controls .

Do these things work with standard?

Can i connect to a access database? I tried OLEadapter1 and a datagrid but
nothing happens when i click on datasource property like VB6...i dont know,
can anyone help please.
 
Hi,

Click on the oledbdataadapter1 in the properties you will see in the
bottom you will see generate dataset. After that wizard is finished you
will see the dataset in the datasource property of the datagrid. One last
step in the form load event you need to fill the dataset.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

DataSet11.Clear()

OleDbDataAdapter1.Fill(DataSet11)

End Sub



Ken

-------------------------


--
hello
I have VB.net standard.
I thought this version has no data access but I have data controls .

Do these things work with standard?

Can i connect to a access database? I tried OLEadapter1 and a datagrid but
nothing happens when i click on datasource property like VB6...i dont know,
can anyone help please.
 
I have got a datagrid working, can I assign a datafield from a datasource to
a textbox like in VB6?
 
john andrew said:
I have got a datagrid working, can I assign a datafield from a datasource to
a textbox like in VB6?

scrub that as i just found out what to do in databindings.

can I navigate like in VB6, move and add ect....can you do this?
 
Hi,

TextBox1.DataBindings.Add("Text", DataSet11.Tables(0), "Country")



Ken
 
Ken Tucker said:
Hi,

TextBox1.DataBindings.Add("Text", DataSet11.Tables(0), "Country")



Ken

Thanks i will try it out,


How do I move next recprd for example? I n VB6 you have a recordset.( Where
can i find this information instead of asking so many questions)
 
In your declarations add:


Private bmb As BindingManagerBase

Then in the section where you make your connection: (or in Form Load if you are not making your connection in code)
bmb = Me.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember)



To step forward thru the records:

Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click

If bmb.Position < bmb.Count - 1 Then

bmb.Position = bmb.Position + 1

' add code here to change the display......such as textboxes etc. that you might have bound to the datagrid fields.

End If

End Sub

To move backwards:

Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click

If bmb.Position > 0 Then

bmb.Position = bmb.Position - 1

End If

' add code here to change the display......such as textboxes etc. that you might have bound to the datagrid fields.

End Sub

This should give you and idea on how it works.
Good luck.
james
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top