M
Mike Fellows
im trying (with great difficulty) to retrieve 1 item of data from a dataset
im trying to put the piece of data into a string from column 0 row 1
here is my code (i guess you will see what im trying to achieve)
Private Function checkduplicate(ByVal Surname As String, ByVal Firstname As
String, ByVal HouseNo As String, ByVal StreetName As String, ByVal Postcode
As String)
Dim conn As New System.Data.SqlClient.SqlConnection(SQLstrConn)
Dim sql As String = "CheckDuplicate '" & Surname & "','" & Firstname
& "','" & HouseNo & "','" & StreetName & "','" & Postcode & "'"
Dim da As New System.Data.SqlClient.SqlDataAdapter(sql, conn)
Dim ds As DataSet = New DataSet()
da.Fill(ds)
Dim RowCount As Integer = ds.Tables(0).Rows.Count
Dim ID As String
I need to set ID equal to column 0 row 1 here
If RowCount = 1 Then
Return ID
Else
Return "Record Does Not Exist"
End If
End Function
Thanks
Mike
im trying to put the piece of data into a string from column 0 row 1
here is my code (i guess you will see what im trying to achieve)
Private Function checkduplicate(ByVal Surname As String, ByVal Firstname As
String, ByVal HouseNo As String, ByVal StreetName As String, ByVal Postcode
As String)
Dim conn As New System.Data.SqlClient.SqlConnection(SQLstrConn)
Dim sql As String = "CheckDuplicate '" & Surname & "','" & Firstname
& "','" & HouseNo & "','" & StreetName & "','" & Postcode & "'"
Dim da As New System.Data.SqlClient.SqlDataAdapter(sql, conn)
Dim ds As DataSet = New DataSet()
da.Fill(ds)
Dim RowCount As Integer = ds.Tables(0).Rows.Count
Dim ID As String
I need to set ID equal to column 0 row 1 here
If RowCount = 1 Then
Return ID
Else
Return "Record Does Not Exist"
End If
End Function
Thanks
Mike