I am using the following code...
vb Code:
Public Function getdatafi(ByVal querystring As String) 'MsgBox(querystring) Using connection As New SqlConnection(GetConnectionStringfi) Dim command As New SqlCommand(querystring, connection) connection.Open() Dim reader As SqlDataReader = command.ExecuteReader While reader.Read Return reader.GetValue(0) End While reader.Close() End Using End Function
vb Code:
tempdimid = getdatafi("SELECT dim_id from dim_info where inspection_id = " & inspectionid & _ " and dim_name = '" & dimname(tempnumber) & "'")
I put a break in and viewed the sql code. It is the correct code but it returns 0. If I run the exact sql code that the program creates in the SQL query anylizer, it returns the correct number. I am using the getdatafi function in other places and it works as it should. Does anyone know why this is not working?




Reply With Quote