VB 6 execute Stored Procedures HEELPP!!

Results 1 to 2 of 2

Thread: VB 6 execute Stored Procedures HEELPP!!

  1. #1
    Join Date
    Dec 1969

    Default VB 6 execute Stored Procedures HEELPP!!

    I have a function in vb6 that should return a recordset from an sp but i allway get errors. what is the problem with the code?<BR><BR>tks for your help<BR><BR>Function:<BR><BR>Dim Str_Conn As String<BR>Dim Conexao As ADODB.Connection<BR>Dim Resultado As ADODB.Recordset<BR>Dim rst As ADODB.Recordset<BR><BR>Str_Conn = "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = testdb; User Id =userid; Password=66gtdbg"<BR><BR><BR>Set Conexao = New ADODB.Connection<BR>Conexao.CommandTimeout = 200<BR>Conexao.ConnectionString = Str_Conn<BR>Conexao.CursorLocation = adUseServer<BR>Conexao.Open<BR><BR>Set rst = New ADODB.Recordset<BR><BR><BR>Dim Cmd As New ADODB.Command<BR><BR>&#039; Set the command object equal to the connection object<BR>Set Cmd.ActiveConnection = Conexao<BR><BR>With Cmd<BR> .CommandText = "return_data"<BR> .CommandType = adCmdStoredProc<BR> <BR> .Parameters("@param1") = "77567"<BR> .Parameters("@param2") = "&#039;%[[]%]%&#039;"<BR> .Parameters("@param3") = "&#039;%[[]gfgdf]%&#039;"<BR> <BR> Set rst = .Execute()<BR> End With<BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default So did you debug?

    Did you try running this function from an VB6 console app or windows app? So that you could set breakpoints, get error messages, etc., etc.???<BR><BR>But I strongly suspect that one problem is that you put &#039; characters into your parameters. I&#039;m 90% certain that&#039;s a mistake.<BR><BR>Not to ask a silly question, but why are you coding something as simple as this in VB6 instead of directly in VBScript in ASP??<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts