Home > Archive > MS SQL Server > August 2005 > Problme using nullable parameters from vb.net









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problme using nullable parameters from vb.net
John

2005-08-20, 8:23 pm

Hi

vb2005/sqlserver2005. I have a stored procedure that accepts three optional
parameters. If I run the following it returns the data fine;

DECLARE @return_value int
EXEC @return_value = [dbo].& #91;NewSelectCommand
]
@CompanyType = NULL,
@Status = NULL,
@BusinessDivision = NULL

If however I use the following in my vb.net app, I get nothing.

Me. CompaniesTableAdapte
r.Fill(Me.EMSDataSet.Companies,
DBNull.Value.ToString, DBNull.Value.ToString, DBNull.Value.ToString)

What is the problem and how can I fix it?

Thanks

Regards


John Bell

2005-08-21, 3:23 am

Hi

You have posted to a large number of groups which may not be appreciated if
they are not relivant. SQL 2005 questions should be posted to the SQL 2005
newsgroup see http://communities.microsoft.com/ne...ps/default.asp?

You may want to also check out:
http://support.microsoft.com/defaul...kb;en-us;267588
http://support.microsoft.com/defaul...kb;en-us;269541
http://support.microsoft.com/defaul...kb;en-us;811889

John

"John" <John@nospam.infovis.co.uk> wrote in message
news:%23vcp5vepFHA.2888@TK2MSFTNGP10.phx.gbl...
> Hi
>
> vb2005/sqlserver2005. I have a stored procedure that accepts three
> optional parameters. If I run the following it returns the data fine;
>
> DECLARE @return_value int
> EXEC @return_value = [dbo].& #91;NewSelectCommand
]
> @CompanyType = NULL,
> @Status = NULL,
> @BusinessDivision = NULL
>
> If however I use the following in my vb.net app, I get nothing.
>
> Me. CompaniesTableAdapte
r.Fill(Me.EMSDataSet.Companies,
> DBNull.Value.ToString, DBNull.Value.ToString, DBNull.Value.ToString)
>
> What is the problem and how can I fix it?
>
> Thanks
>
> Regards
>



Cor Ligthert [MVP]

2005-08-21, 3:23 am

John,

I cannot find the method you are using so if you have documentation about
that please show us. In VB2003 is this in my opinion the most simple method
to use with parameters.

http://www. windowsformsdatagrid

I hope this helps,

Cor


Erland Sommarskog

2005-08-21, 8:23 pm

John (John@nospam.infovis.co.uk) writes:
> vb2005/sqlserver2005. I have a stored procedure that accepts three
> optional parameters. If I run the following it returns the data fine;
>
> DECLARE @return_value int
> EXEC @return_value = [dbo].& #91;NewSelectCommand
]
> @CompanyType = NULL,
> @Status = NULL,
> @BusinessDivision = NULL
>
> If however I use the following in my vb.net app, I get nothing.
>
> Me. CompaniesTableAdapte
r.Fill(Me.EMSDataSet.Companies,
> DBNull.Value.ToString, DBNull.Value.ToString, DBNull.Value.ToString)
>
> What is the problem and how can I fix it?


I don't really know what DBNull.Value.ToString() returns, but it is
not likely to be a NULL value. My guess goes for the string "NULL" which
is something completely different.

In any case, you desperately need to be more discriminate in your selection
of newsgroups, or else people will grew tired of you quickly.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com