Re: ADO reads null values from Sybase stored procedure result
From: Val Mazur (group51a_at_hotmail.com)
Date: 04/24/04
- Next message: Kevin Yu [MSFT]: "Re: efficient way to retrieve master-details data"
- Previous message: Kevin Yu [MSFT]: "Re: Adding two a Datagrid"
- In reply to: Carolina: "Re: ADO reads null values from Sybase stored procedure result"
- Next in thread: Teaser: "Re: ADO reads null values from Sybase stored procedure result"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Kevin Yu [MSFT]: "Re: efficient way to retrieve master-details data"
- Previous message: Kevin Yu [MSFT]: "Re: Adding two a Datagrid"
- In reply to: Carolina: "Re: ADO reads null values from Sybase stored procedure result"
- Next in thread: Teaser: "Re: ADO reads null values from Sybase stored procedure result"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|