Re: ADO reads null values from Sybase stored procedure result

From: Val Mazur (group51a_at_hotmail.com)
Date: 04/24/04


Date: Fri, 23 Apr 2004 22:12:17 -0400

Hi,

I think this could be a bug in a Sybase provider. What you could do is to
use Sybase ASE OLEDB Provider. I am using it in my development right now. It
has its own issues, but you could try to see if it fixes the issue with
nulls. You connection string would be like

"Provider=Sybase ASE OLE DB Provider;Server Name=MyServerNameHere;Initial
Catalog=MyDatabaseNameHere;User ID=MyIDHere;Password=PasswordHere;"

Do not forget to use Oledb Managed provider instead. Potential issues with
this connection string is that if your Sybase server configured to use other
port address that 5000, then you need to specify port number as well. For
example with port number 6000 it would look like

"Provider=Sybase ASE OLE DB Provider;Server
Name=MyServerNameHere,6000;Initial Catalog=MyDatabaseNameHere;User
ID=MyIDHere;Password=PasswordHere;

-- 
Val Mazur
Microsoft MVP
"Carolina" <ccordero@gmx.net> wrote in message 
news:f464b802.0404230910.5a074711@posting.google.com...
> VB.NET code:
>
> Dim strcon As String
> strcon = "Driver=Sybase System 11;SRVR=srvname;DB=bdname;
> UID=login;PWD=password;WKID=hostname;APP=appname"
>
> Dim cn As New OdbcConnection(strcon)
> cn.Open()
>
> Dim cmd As New OdbcCommand()
> With cmd
>    .Connection = cn
>    .CommandType = CommandType.StoredProcedure
>    .CommandText = "{call myprocname ?, ?}"
> End With
>
> With cmd.Parameters
>    .Add("Date", OdbcType.Date).Value = CDate("Mar 7 2004")
>    .Add("EmpID", OdbcType.Char, 6).Value = "123456"
> End With
>
> Dim dr As OdbcDataReader = cmd.ExecuteReader
>
> Do While dr.Read
>    ListBox1.Items.Add(IIf(IsDBNull(dr("columnname")), "null value", _
>    dr("columnsname").ToString))
> Loop
>
> VB.NET considerations:
> I'm using ODBC .NET Data Provider (Namespace:  Microsoft.Data.Odbc),
> because it was the only way I found for connecting to Sybase.  (Any
> suggestions about this would be very useful!)
>
>
> For VB6, I'm using DataEnvironment and a command with this Properties:
> General tab:
>   Dababase Object:  Stored Procedure
>   Object Name:      dbo.myprocname
> Advanced tab:
>   Lock type:  1 - Read Only
>   Recordset returning:  On
>
> Procedure call:
>   Call mydataenvironment.mycommandname(mydate, myempId)
> then I retrieve results from recordset 


Relevant Pages

  • Re: ADO reads null values from Sybase stored procedure result
    ... I think this could be a bug in a Sybase provider. ... this connection string is that if your Sybase server configured to use other ... > Dim cn As New OdbcConnection ...
    (microsoft.public.vb.database.ado)
  • Re: ADO reads null values from Sybase stored procedure result
    ... I think this could be a bug in a Sybase provider. ... this connection string is that if your Sybase server configured to use other ... > Dim cn As New OdbcConnection ...
    (microsoft.public.data.ado)
  • RE: Count of fields in Database
    ... Usually you can just query the appropriate system table that contains ... Dim cnnDatabase As New ADODB.Connection ... ' Use appropriate OLE or ODBC connection string for connecting to SyBase ...
    (microsoft.public.access.queries)
  • Re: problem with data access?!?!?!
    ... Remove the Provider= clause from your connection string. ... Dim SqlDatasource1 As New SqlDataSource ... Dim strBOConnection As String = ConfigurationManager.ConnectionStrings ...
    (microsoft.public.dotnet.general)
  • Re: Connection String Problem
    ... So I was trying to check the provider of the connection string and have ... provider which can access any database. ... dim arr as new ArrayList ...
    (microsoft.public.dotnet.framework.aspnet)

Quantcast