473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Navigating the records and binding it to text box

Hello all,

I am a bignner to vb.net

I am not able to move the dataset and bind the textbox to dataset.
My objective is
1) when the form loads it should display the first record.
and the user should be able to move next and move previous and move
last and move first .
2) Binding the textbox to the dataset
what is the equivlant of text1.text = rs.fields("subject_id") in
vb.net
3) What is the best method of opening the connection and sqldataset ,
sqlcommand

Here is the code where i get an error in the binding.

Form_load

Dim conn As New SqlConnection
Dim cmdSubjects As New SqlCommand
Dim dsSubjects As New DataSet
Dim daSubjects As New SqlDataAdapter
Dim StrSQL As String
Dim SQL_Connection_String As String

SQL_Connection_String = "Server=myserver; DataBase=my_testdb;
Integrated Security=SSPI"

StrSQL = "Select * from Subjects"

conn = New SqlConnection(SQL_Connection_String)
conn.Open()
cmdSubjects = New SqlCommand(StrSQL, conn)

dsSubjects = New DataSet

daSubjects = New SqlDataAdapter(StrSQL, conn)
daSubjects.Fill(dsSubjects, "Subjects")

DataGrid1.DataSource = dsSubjects.Tables!Subjects
TextBox1.DataBindings.Add ("Text", dsSubjects.Tables!Subjeects,
"Subject_ID")
(i get the error at this point)

End sub
Thank in advance.
Please mail to ma******@hotmail.com or ma******@yahoo.com

From
madhu
Nov 20 '05 #1
1 1671
Hi,

Use the currency manager to navigate records. Here is a simple example.
http://www.onteorasoftware.com/downl...aterecords.zip

Ken
---------------------

"madhu" <ma******@hotmail.com> wrote in message
news:83**************************@posting.google.c om:
Hello all,

I am a bignner to vb.net

I am not able to move the dataset and bind the textbox to dataset.
My objective is
1) when the form loads it should display the first record.
and the user should be able to move next and move previous and move
last and move first .
2) Binding the textbox to the dataset
what is the equivlant of text1.text = rs.fields("subject_id") in
vb.net
3) What is the best method of opening the connection and sqldataset ,
sqlcommand

Here is the code where i get an error in the binding.

Form_load

Dim conn As New SqlConnection
Dim cmdSubjects As New SqlCommand
Dim dsSubjects As New DataSet
Dim daSubjects As New SqlDataAdapter
Dim StrSQL As String
Dim SQL_Connection_String As String

SQL_Connection_String = "Server=myserver; DataBase=my_testdb;
Integrated Security=SSPI"

StrSQL = "Select * from Subjects"

conn = New SqlConnection(SQL_Connection_String)
conn.Open()
cmdSubjects = New SqlCommand(StrSQL, conn)

dsSubjects = New DataSet

daSubjects = New SqlDataAdapter(StrSQL, conn)
daSubjects.Fill(dsSubjects, "Subjects")

DataGrid1.DataSource = dsSubjects.Tables!Subjects
TextBox1.DataBindings.Add ("Text", dsSubjects.Tables!Subjeects,
"Subject_ID")
(i get the error at this point)

End sub
Thank in advance.
Please mail to HYPERLINK "mailto:ma******@hotmail.com"ma******@hotmail. com
or HYPERLINK "mailto:ma******@yahoo.com"ma******@yahoo.com

From
madhu


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.0 - Release Date: 6/12/2004
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset...
3
by: Martin Williams | last post by:
This is my first post to this group. I am currently working on a project for my Intermediate vb.net class. My project is a movie rental program, which involves displaying customer records with...
15
by: Joachim | last post by:
Hi, Als a beginner, I am looking for a way to show records My code is Private sub Connection( Dim odbconn_Pro As OleDbConnectio Dim odbcomm_Pro As OleDbComman Dim odbdare_Pro As...
3
by: Monty | last post by:
Hi there, I have a simple medical database with patient records. I use: TotalRecords.Text = DetailsViewMain.DataItemCount & " records" to reflect the number of patients in the db. I then filter...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
6
by: mike11d11 | last post by:
My program has to tables in it. One is the Accounts table with all personal information and then there is also my Memos table with all the notes for each account. My program displays one record...
0
by: Ohad Weiss | last post by:
Hi all, I've once asked about that topic. but didn't get an answer. I have a dataset based on 4 tables, which have relation between them. The main table presented to the user on textboxes...
0
by: Ohad Weiss | last post by:
Hi I have a problem with two textboxes binded to a dataset, based on paren table, and table for the child records. I can navigate between the master records (and of course the child records...
2
tuxalot
by: tuxalot | last post by:
Strange occurrence and I've looked everywhere and can't seem to find any explanation. Using A07, when I navigate records using the built-in buttons, the text in my labels darkens increasingly while...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.