please help with dataset !

sudani1969

Member
Joined
Sep 25, 2009
Messages
13
Programming Experience
Beginner
hi everyone
it is me again
i'm using VS2010 to design small program i joined 2 tables using the Dataset Designer i manged to link t1 and t2 and produce a table t3 with my selection statement, I managed to produce it through a Tabledatadapter
i want from that dataset to extract information to suit my following code but so far i could only managed what is in Row(0) from that table
ANY ONE COULD HELP TO SEE IF I CAN CHECK FOR THE WHO ROWS OF THAT TABLE MY CODE IS BELOW@

Case "user"
con.open()
Dim sql As String
'
Dim dss As New attendanceDataSet1
Dim ct As New attendanceDataSet1TableAdapters.dr1
Dim inc As Integer = 0
Dim sqDR As MySqlDataReader
Dim cmm As New MySqlCommand
Dim dr As MySqlDataReader
ct.Fill(dss.t1)
If dss.t1.Rows(0).Item(1) = txtUser.Text Then


MsgBox("Stop")

Else



cmd.Connection = con
cmd.CommandText = ("insert into login_details (user, date, login,ComputerIPAddrees) values((SELECT id FROM users WHERE username = '" & txtUser.Text & "'),CURDATE(),CURTIME(),'" & strHostName & "')")
dr = cmd.ExecuteReader()
' dr.Read()
' Dim switch As New user_attendance
txtUser.Clear()
txtPass.Clear()
txtUser.Focus()


End If


con.close() '
End Select
 
here what i have done to solve my issue
i called my dataTableadapter then link it to my dataset tableadapter
then filled that datatable adapter with my dataset and then created table row arrays where i looked and counted how many row does exists in my query if they are greater than 0 then........else do...

Dim dt As attendanceDataSetTableAdapters.DataTable1TableAdapter
dt = New attendanceDataSetTableAdapters.DataTable1TableAdapter()
dt.Fill(AttendanceDataSet.DataTable1)
'Dim ds As New attendanceDataSet

Dim rCf() As attendanceDataSet.DataTable1Row
rCf = AttendanceDataSet.DataTable1.Select("username = '" & txtUser.Text & "' AND `date`= '" & Now.Date & "'")
If rCf.Count > 0 Then
MsgBox("Stop")
Else
 
When working with databases, it is better to have the database do the searching because that is what they are designed for - there's no point storing 100,000 rows in a database, downloading them all and then just selecting the one you want,within your client app
 
Back
Top