Stored Procedures



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

  • Re: Stored Procedures & Connection Issue
    ... I have had to use adCmdText with MySQL stored procedures. ... Dim adoConnection As New ADODB.Connection ... Dim SQL_hierarchy_level As String ... Dim strDatabasePathAndName As String ...
    (microsoft.public.excel.programming)
  • Re: Stored Procedure creation in vb.net
    ... 'use these stored procedures ... 'this creates table with single column: [RecNum] int NOT NULL ... Private Sub udp_CreateTable(ByVal DataBaseNameForNewTable As String, ...
    (microsoft.public.dotnet.languages.vb)
  • Return Results of sp_helptext via ADO
    ... I am trying to write code to document stored procedures for an Access ... Dim daorsStoredProcs As DAO.Recordset ... Dim strSQLStoredProcBase As String ... Set adoconnStoredProcText = New ADODB.Connection ...
    (microsoft.public.data.ado)
  • Re: Insert Byte array to SQL Server using string
    ... The imgStr value should not be quoted when inserted into the textual query ... If you have large images or just a large number of them there are more efficient ways to get a hex string from the Byte- just search for "dotnet Byteformat Hex" in google groups and you'll find some posts. ... I agree with Marc, however, that you may want to think about using parameterized queries or stored procedures if only because you may forget to escape the ' character from time to time, but it will probably help performance as well, make your code more legible and probably make debugging easier. ... At the moment, I am storing a few 32x32 images, so it's not massive amounts of data (it's basically storing an icon to be displayed on a button, these are configurable by the user, and stored in the DB to eliminate file path problems etc...) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Insert Byte array to SQL Server using string
    ... What you would want to do, if you decide to stick with a textual query, is ... more efficient ways to get a hex string from the Byte- just search for ... parameterized queries or stored procedures if only because you may forget ... so it's not massive amounts of data (it's basically storing an ...
    (microsoft.public.dotnet.languages.csharp)