|
Subject:
|
Beginner
|
|
Posted By:
|
acko
|
Post Date:
|
10/27/2003 6:46:40 AM
|
Hi I complityly new in .NET and have a lot of problems I would like to do basic task: 1) Open connection 2) fill data set 3) find out if dataset is bof or eof but in ado net there is no bof and eof property haw can i do this task Here is my code
Dim CN As New SqlConnection Dim DA As New SqlDataAdapter Dim DS As New DataSet Dim cmd As New SqlClient.SqlCommand
Dim strSQL As String dim cnString as String
cnString = "someString" strSQL = "SELECT SUBJEKT,GESLO from CONTACTS " _ & " WHERE USERID = '" & UserName & "'"
CN.ConnectionString = cnString cmd.CommandText = strSQL cmd.CommandType = CommandType.Text cmd.Connection = CN
CN.Open()
DA.SelectCommand = cmd DA.SelectCommand.ExecuteNonQuery()
Try DA.Fill(DS)
Catch ex As Exception
End Try
Here i want to ask for dataset if it is bof or eof
Thanks Aleksandar
|
|
Reply By:
|
Imar
|
Reply Date:
|
10/27/2003 7:23:23 AM
|
Hi Aleksandar,
A DataSet does not have an EOF or BOF property, like an ADO Recordset does. You can, however, find out whether one of the tables in the DataSet contains 1 or more rows:If DS.Tables(0).Rows.Count > 0 Then This code checks whether the first table in the DataSet contains at least a row.
HtH,
Imar
--------------------------------------- Imar Spaanjaars Everyone is unique, except for me.
|