B
Bonzol
Hey there,
I think this is not actually VB, but the language im using is VB. Ive
been doing all my code,, NOT using Stored procedures.. so my functions
are like.(in 2003)
visual basic
code:--------------------------------------------------------------------------------
Public Function vLookup(ByVal table As String, ByVal returnColumn As
String, ByVal checkColumn As String, ByVal checkValue As String) As
String
Dim StringToReturn As String
StringToReturn = ""
Dim SQL As String
SQL = "SELECT " + returnColumn + " from " + table + " where " +
checkColumn + " = " + checkValue + ""
Dim dataAdapter As System.Data.OleDb.OleDbDataAdapter
dataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQL,
Me.OleDbConnection1)
Try
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
dataAdapter.Fill(dt)
If dt.Rows.Count > 0 Then
If dt.Rows(0).ItemArray.Length > 0 Then
StringToReturn = CStr(dt.Rows(0).Item(0))
End If
End If
Catch
StringToReturn = "-1"
End Try
Return StringToReturn
End Function
--------------------------------------------------------------------------------
MY question is how do I change this to function to us a stored
procedure that does the same thing. Stored procedures are in SQL server
2000? Now using .net 2005
lets call the stored proecedure stoCustomer
thanx in advance
I think this is not actually VB, but the language im using is VB. Ive
been doing all my code,, NOT using Stored procedures.. so my functions
are like.(in 2003)
visual basic
code:--------------------------------------------------------------------------------
Public Function vLookup(ByVal table As String, ByVal returnColumn As
String, ByVal checkColumn As String, ByVal checkValue As String) As
String
Dim StringToReturn As String
StringToReturn = ""
Dim SQL As String
SQL = "SELECT " + returnColumn + " from " + table + " where " +
checkColumn + " = " + checkValue + ""
Dim dataAdapter As System.Data.OleDb.OleDbDataAdapter
dataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQL,
Me.OleDbConnection1)
Try
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
dataAdapter.Fill(dt)
If dt.Rows.Count > 0 Then
If dt.Rows(0).ItemArray.Length > 0 Then
StringToReturn = CStr(dt.Rows(0).Item(0))
End If
End If
Catch
StringToReturn = "-1"
End Try
Return StringToReturn
End Function
--------------------------------------------------------------------------------
MY question is how do I change this to function to us a stored
procedure that does the same thing. Stored procedures are in SQL server
2000? Now using .net 2005
lets call the stored proecedure stoCustomer
thanx in advance