473,396 Members | 1,748 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,396 software developers and data experts.

vb.net database programming

hi friends...
i am new to VB.NET.i was trying to read some data from the database
using code,
and display that in 2 textboxes.i was able to get only the first row.
i used ExecuteReader() function of SqlCommand class and read()
function to read data..
i have put a button on the form to advance the records..
in that click method i have called the read() function...
but it's not moving to the next record...even after clicking the
button...
please help me anyone...
thanks and regards...
sandeep...

Oct 14 '06 #1
3 961
Could you post your code? That way we can see what is going on.

Thanks,

Seth Rowe
sandy wrote:
hi friends...
i am new to VB.NET.i was trying to read some data from the database
using code,
and display that in 2 textboxes.i was able to get only the first row.
i used ExecuteReader() function of SqlCommand class and read()
function to read data..
i have put a button on the form to advance the records..
in that click method i have called the read() function...
but it's not moving to the next record...even after clicking the
button...
please help me anyone...
thanks and regards...
sandeep...
Oct 14 '06 #2
Thanks Seth Rowe...

i will paste the code...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

cn = New SqlConnection("Data Source=VIDYAMAYI18\SQLEXPRESS;Initial
Catalog=model;Integrated Security=True")

sqlcmd = New SqlCommand()
sqlcmd.CommandText = "select * from infotab"
sqlcmd.Connection = cn
cn.Open()
sqlreader = sqlcmd.ExecuteReader()

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles nextbutton.Click

sqlreader.Read()
txtname.Text = sqlreader(0)
txtaddress.Text = sqlreader(1)

End Sub

Protected Sub Page_Unload(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Unload

cn.Close()

End Sub
i tried to fetch the records as i press the button and display the data
in textboxes...

thanks and regards
sandeep...

Oct 14 '06 #3
Sandy,

Just use Databinding that makes it more easy and more from this time.

http://www.vb-tips.com/dbpages.aspx?...9-4deb7fa4a0b8

I hope this helps,

Cor

"sandy" <sa*******@gmail.comschreef in bericht
news:11**********************@k70g2000cwa.googlegr oups.com...
hi friends...
i am new to VB.NET.i was trying to read some data from the database
using code,
and display that in 2 textboxes.i was able to get only the first row.
i used ExecuteReader() function of SqlCommand class and read()
function to read data..
i have put a button on the form to advance the records..
in that click method i have called the read() function...
but it's not moving to the next record...even after clicking the
button...
please help me anyone...
thanks and regards...
sandeep...

Oct 14 '06 #4

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

Similar topics

2
by: A Cate | last post by:
I am new to PHP. I am trying to develop a web site on a development machine that needs to access data in a mysql database. I have mysql running on my development machine with a copy of the...
0
by: John Davis | last post by:
I always heard the term "data/database driven programming" model in ASP database, SQL programming, and web programming circles. But I don't quite sure what does it mean? Does it mean the web...
2
by: hplloyd | last post by:
I am fairly new to VB.NET programming but have built many database applications in Access SQL Server etc. I need to find a good book or other reference material that will help me take my OO...
6
by: Randy Yates | last post by:
Hi Folks, I'm looking for something that is completely independent of the MSVC++ Dev Studio environment, something that will compile and run under win32 using the mingw distribution. A class...
3
by: Alan | last post by:
I am coming from other programming tools field, and new to VB .NET. Just wondering what is the common approaching in database programming in VB .NET? 1) Are you guru always using the data aware...
3
by: jaYPee | last post by:
i am searching a lot of resources in the net that discusses about database programming. i'm still searching on it and would like to received any links that discusses about database programming in...
1
by: Dave | last post by:
Hi, I work on a small team that currently uses an access 97 database for managing peoples time. The database front end is heavily implemented in VBA and is secured with user level security,...
8
by: Maxi | last post by:
Hello, i'm sorry my bad english :( I have CR9 Webservice, how to change databadse name and User_name into Webservice method? (not Viewer Control) Tks!! -- --------------------------
2
by: webcm123 | last post by:
People say that structural programming isn't good for database connection. I code fast-running structural oriented CMS and I don't know what I should do. I use mysql connection using mysql_*. I...
4
by: triton96 | last post by:
I want to get in to programming but would like your input on a couple of things: I would like to write some basic applications that would for example create a payroll check or create a billing for...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.