problem in displayin records on a form
Dim str AsString = "select * from table1"
'try to write "select distinct * from table1"
Dim con As String = ConfigurationSettings.AppSettings("preeconn")
Dim cmd As New SqlCommand(str, New SqlConnection(con))
cmd.Connection.Open()
Dim da As New SqlDataAdapter(str, con)
Dim ds As New DataSet
da.Fill(ds, "table1")
Dim maxrws As Integer
Dim i As Integer
maxrws = ds.Tables("table1").Rows.Count 'used to get the count of number of rows in a table
i = 0
For i = 0 To maxrws - 1
id_txt.Text = ds.Tables("table1").Rows(i).Item("ID").ToString()
name_txt.Text = ds.Tables("table1").Rows(i).Item("Name").ToString()
age_txt.Text = ds.Tables("table1").Rows(i).Item("Age").ToString()
sex_txt.Text = ds.Tables("table1").Rows(i).Item("Sex").ToString()
area_txt.Text = ds.Tables("table1").Rows(i).Item("Area").ToString()
Next i
name_txt.Text = ds.Tables("table1").Rows(i).Item("Name").ToString()
age_txt.Text = ds.Tables("table1").Rows(i).Item("Age").ToString()
sex_txt.Text = ds.Tables("table1").Rows(i).Item("Sex").ToString()
area_txt.Text = ds.Tables("table1").Rows(i).Item("Area").ToString()
----------------this is codin under next_button click.but at the moment its displayin only first record from the database on the form..plz tell m whats the problem...
preetham.saroja
Junior Poster in Training
82 posts since Jun 2007
Reputation Points: 5
Solved Threads: 1
thanks for the quick reply for both of u,
but i dont c any changes-inspite i declare it has global variables& else if i use while-loop instead of if-loop...(And also it returns maxrws=26)
plz helpmm
preetham.saroja
Junior Poster in Training
82 posts since Jun 2007
Reputation Points: 5
Solved Threads: 1
yes,sir
I understood what u said,but inspite i declare global variable&also i dont use loops-im n2 able to access the records--
can u plz give m details to how to write the code...
thanks..
preetham.saroja
Junior Poster in Training
82 posts since Jun 2007
Reputation Points: 5
Solved Threads: 1