473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

calling stored procedures with parameters

I have a form with 5 strings serving as search parameters.
I collect them from the form, store them in local variables and call a
stored procedure executing a select based on these parameters
When the parameters are left empty in the form, I nees to make a select
without conditions on that parameter.
How to call the stored procedure in VB.net, when the variables contain null
values?

Jul 21 '05 #1
3 1366
http://www.knowdotnet.com/articles/d...arameters.html
"news.verizon.net" <no****@nospam.no> wrote in message
news:J5*****************@nwrdny02.gnilink.net...
I have a form with 5 strings serving as search parameters.
I collect them from the form, store them in local variables and call a
stored procedure executing a select based on these parameters
When the parameters are left empty in the form, I nees to make a select
without conditions on that parameter.
How to call the stored procedure in VB.net, when the variables contain null values?

Jul 21 '05 #2
Very good article indeed, but my problem is like
cmd.Parameters.Add("@p_FirstValue", myvar);

where mycar can be assigned plenty of values including NULL.
the null how is it passed?

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:eX**************@TK2MSFTNGP10.phx.gbl...
http://www.knowdotnet.com/articles/d...arameters.html
"news.verizon.net" <no****@nospam.no> wrote in message
news:J5*****************@nwrdny02.gnilink.net...
I have a form with 5 strings serving as search parameters.
I collect them from the form, store them in local variables and call a
stored procedure executing a select based on these parameters
When the parameters are left empty in the form, I nees to make a select
without conditions on that parameter.
How to call the stored procedure in VB.net, when the variables contain

null
values?


Jul 21 '05 #3
Don't give it a value ("@p_FirstValue") or ("@p_FirstValue", DbNull.Value)
"news.verizon.net" <no****@nospam.no> wrote in message
news:%1*****************@nwrdny03.gnilink.net...
Very good article indeed, but my problem is like
cmd.Parameters.Add("@p_FirstValue", myvar);

where mycar can be assigned plenty of values including NULL.
the null how is it passed?

"William Ryan" <do********@nospam.comcast.net> wrote in message
news:eX**************@TK2MSFTNGP10.phx.gbl...
http://www.knowdotnet.com/articles/d...arameters.html
"news.verizon.net" <no****@nospam.no> wrote in message
news:J5*****************@nwrdny02.gnilink.net...
I have a form with 5 strings serving as search parameters.
I collect them from the form, store them in local variables and call a
stored procedure executing a select based on these parameters
When the parameters are left empty in the form, I nees to make a select without conditions on that parameter.
How to call the stored procedure in VB.net, when the variables contain

null
values?



Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Shaun Stuart | last post by:
I've got a webpage that calls some stored procedures with input variables. The procedures return recordsets and also some output variables. We're trying to get the values of the output variables....
1
by: Robert Scheer | last post by:
Hi. I wrote some stored procedures used by a web application. As I am fairly new to Oracle, I am missing some concepts when creating these procedures, as a result, the application is suffering...
1
by: Lauren Quantrell | last post by:
I'm using an Access2K front end on a SQL Server2K backend. I use Scope_Identity() in a lot of stored procedures to pass the newwly inserted record's unique ID to the next select statement in the...
5
by: Zlatko Matić | last post by:
Hello. How can I call some functions on MSDE when working in .mdb ? Especially in-line functions which are similar to stored procedures. How can I use MSDE in-line functions as recordsource for...
6
by: Scott McNair | last post by:
Hi all, I'm having problems calling a stored procedure from within my code. If I execute the SP manually from a Query Analyzer window it runs without a hitch, but it seems it doesn't even fire...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
4
by: Jack | last post by:
Hi, I am trying to run an example code from a book. However I am getting the following error message: Number: -2147217900 Description: Syntax error or access violation Source: Microsoft OLE...
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
1
by: jobs | last post by:
I have a growning list of stored procedures that accept a single string as a parameter. The list and parameters are maintained in a table with two columns. Some of the Stored procedures take...
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.