hi
how can if call a strored prosedure from sql server with parameters
my procedure is
ALTER PROCEDURE [dbo].[search_proced] ( @p_version nvarchar(100),
@p_result nvarchar(100),
@Salesman int , @from_Date datetime ,
@to_date datetime )
and i have to use the result in gridview
10x for helping me
2 1115 Plater 7,872
Recognized Expert Expert
Use the SQLCommand object.
Here's how I do it: -
DataTable retval = new DataTable();
-
//dbcon is your database connection object
-
SqlCommand sc = new SqlCommand("search_proced", dbcon);
-
sc.CommandType = CommandType.StoredProcedure;
-
sc.Parameters.Add("@p_version", SqlDbType.NVarChar);
-
sc.Parameters["@p_version"].Value = "Something";
-
//
-
//repeat for your other parameters
-
//
-
SqlDataAdapter sda = new SqlDataAdapter(sc);
-
sda.Fill(retval);
-
sc.Dispose();
-
sda.Dispose();
-
//now "retval" is a DataTable that can be used as a DataSource for your GridView;
-
-
hi
how can if call a strored prosedure from sql server with parameters
my procedure is
ALTER PROCEDURE [dbo].[search_proced] ( @p_version nvarchar(100),
@p_result nvarchar(100),
@Salesman int , @from_Date datetime ,
@to_date datetime )
and i have to use the result in gridview
10x for helping me
10x Plater for helping me
i tested ur script and it work fine;
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: PJ |
last post by:
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open application("dtat_motor_connectionstring")
set rs = new adodb.recordset
'Set RS = Conn.Execute(' "exec spcn_update_transactions &
customer_number, customer_name, customer_address, customer_city,
customer_state, customer_zip, customer_phone, vin,
acct_number, tag, title_number, tag_type_number, branch_number,
institution_number, yr_make, state_from, type_number)...
|
by: Noloader |
last post by:
Hello,
Access XP, SQL Server 2000
Is it possible to hide a SP under Queries in Access, yet still be able
to Execute it from Access?
We hooked up a custom form to accept the input parameters (MS Feature
Request!) for the Stored Procedure. We had two problems with MS's
'Input Parameter' dialog: 1) We could not customize, 2) We continually
|
by: Noloader |
last post by:
Hello,
Access XP, SQL Server 2000
Is it possible to hide a SP under Queries in Access, yet still be able
to Execute it from Access? (Similar to hiding Tables, then using
Views)
We hooked up a custom form to accept the input parameters (MS Feature
Request!) for the Stored Procedure. We had two problems with MS's
|
by: Eli |
last post by:
Hi all
We currently have a strange problem with calling a Stored Procedure
(SQL Database) in our C# Project. The only error I get is "System
error" which says a lot :)
Background:
We have several stored procedures to Insert and update datas in our
SQL database. Some stored procedures are smaller (insert datas in only
one table) and some of them are quite big (insert datas in several
|
by: shsandeep |
last post by:
I 'recreated' a stored procedure.
Earlier, i had given privileges to a particular group but now (after
rebuilding) when I try to grant execute privilege for the SP to the same
user group, it gives me the below message.
Any clues on this??
SQL0458N In a reference to routine
"SITSCHM.SP_ERND_PREM" by signature, a matching routine could
not be found. SQLSTATE=42883
| |
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |