Re: Stored Procedures



Looking at your SQL statement, a "normal" stored procedure won't be
able to replace it. You'll have to use a stored procedure that uses
dynamic SQL. You may want to search the comp.databases.ms-sqlserver
newsgroup on what this means and how to write one. Also check out
http://support.sas.com/ctx/samples/index.jsp?sid=817 it's a great
article on using both ADO and ADO.NET to call stored procs with VB.NET
and C#. If you need further help please post again and I'll try to walk
you through whatever you need.

Thanks,

Seth Rowe


Bonzol wrote:
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

.



Relevant Pages