473,657 Members | 2,595 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Stored Procedure in SqlDataSource Won't Workd

When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE, the
GridView tied to the SqlDataSoure is empty.

How do I get this working?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
Jul 28 '06 #1
9 2211
Ron
Just a thought...
Are you using optimistic concurrency where the WHERE clause is finding no
results. I believe in this case no error is returned, but nor are any rows.

Good luck in fixing the problem.

Regards

Ron.

"Dan Sikorsky" <Da*********@di scussions.micro soft.comwrote in message
news:CB******** *************** ***********@mic rosoft.com...
When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE,
the
GridView tied to the SqlDataSoure is empty.

How do I get this working?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS

Jul 28 '06 #2
chances are you havent set up a default value for your parameter and/or set
it to a control/querystring etc etc.

so when the grid loads it wants a value for its parameter question becomes
where does it get it from?
"Dan Sikorsky" wrote:
When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE, the
GridView tied to the SqlDataSoure is empty.

How do I get this working?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
Jul 29 '06 #3
I don't think your comment applies ... remember, I get the rows when I do a
Test Query in th SqlDataSource control, which is the datasource of the
GridView, but no rows when I run the web app.
--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Ron" wrote:
Just a thought...
Are you using optimistic concurrency where the WHERE clause is finding no
results. I believe in this case no error is returned, but nor are any rows.

Good luck in fixing the problem.

Regards

Ron.

"Dan Sikorsky" <Da*********@di scussions.micro soft.comwrote in message
news:CB******** *************** ***********@mic rosoft.com...
When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE,
the
GridView tied to the SqlDataSoure is empty.

How do I get this working?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS


Jul 29 '06 #4
I have one parameter which I get in the Page_Load event from
Request.Serverv ariables("LOGON _USER"), and have verified that it is set to a
loginid.

I store this loginid in a Property that stores the value in the ViewState.

I use a TextBox control that has a style=display:n one, and a Text value set
to the Property.

Finally, I have a SqlDataSource SELECT control parameter set to the TextBox
control.

Should I use the Page_PreRender event instead?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Sean" wrote:
chances are you havent set up a default value for your parameter and/or set
it to a control/querystring etc etc.

so when the grid loads it wants a value for its parameter question becomes
where does it get it from?
"Dan Sikorsky" wrote:
When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE, the
GridView tied to the SqlDataSoure is empty.

How do I get this working?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
Jul 29 '06 #5
I think you are on the right track when thinking about the page lifecycle.
I think your best bet would be one of the events of the SQLDataSource
control or the gridview control istelf.
Perhaps the gridviews databinding event.
Also maybe you could access the Requesti.Server variables("LOGI N_USER")
directly instead of pasing it to another control. If you follow what I am
suggesting

"Dan Sikorsky" wrote:
I have one parameter which I get in the Page_Load event from
Request.Serverv ariables("LOGON _USER"), and have verified that it is set to a
loginid.

I store this loginid in a Property that stores the value in the ViewState.

I use a TextBox control that has a style=display:n one, and a Text value set
to the Property.

Finally, I have a SqlDataSource SELECT control parameter set to the TextBox
control.

Should I use the Page_PreRender event instead?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Sean" wrote:
chances are you havent set up a default value for your parameter and/or set
it to a control/querystring etc etc.

so when the grid loads it wants a value for its parameter question becomes
where does it get it from?
"Dan Sikorsky" wrote:
When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE, the
GridView tied to the SqlDataSoure is empty.
>
How do I get this working?
>
--
Thank you kindly,
>
Dan Sikorsky BA, BSCE, MCS
Jul 29 '06 #6
I put a breakpoint on the SqlDataSource OnSelecting event and the
e.Command.Param eters[0] says the loginid is there; so it is being passed to
the Stored Procedure.
--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Sean" wrote:
I think you are on the right track when thinking about the page lifecycle.
I think your best bet would be one of the events of the SQLDataSource
control or the gridview control istelf.
Perhaps the gridviews databinding event.
Also maybe you could access the Requesti.Server variables("LOGI N_USER")
directly instead of pasing it to another control. If you follow what I am
suggesting

"Dan Sikorsky" wrote:
I have one parameter which I get in the Page_Load event from
Request.Serverv ariables("LOGON _USER"), and have verified that it is set to a
loginid.

I store this loginid in a Property that stores the value in the ViewState.

I use a TextBox control that has a style=display:n one, and a Text value set
to the Property.

Finally, I have a SqlDataSource SELECT control parameter set to the TextBox
control.

Should I use the Page_PreRender event instead?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Sean" wrote:
chances are you havent set up a default value for your parameter and/or set
it to a control/querystring etc etc.
>
so when the grid loads it wants a value for its parameter question becomes
where does it get it from?
>
>
"Dan Sikorsky" wrote:
>
When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE, the
GridView tied to the SqlDataSoure is empty.

How do I get this working?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
Jul 29 '06 #7
Then I am at a loss other then perphaps that userid doesnt exist in the
database.
Naturally it might be that the user value simply doesnt exist in the table
but as you say you already tried it out generating a query.

I am currently investigating very mysterious problems I am having with the
SQLDatasource control referencing sproc signatures that no longer exist. Its
been very troubling.

"Dan Sikorsky" wrote:
I put a breakpoint on the SqlDataSource OnSelecting event and the
e.Command.Param eters[0] says the loginid is there; so it is being passed to
the Stored Procedure.
--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Sean" wrote:
I think you are on the right track when thinking about the page lifecycle.
I think your best bet would be one of the events of the SQLDataSource
control or the gridview control istelf.
Perhaps the gridviews databinding event.
Also maybe you could access the Requesti.Server variables("LOGI N_USER")
directly instead of pasing it to another control. If you follow what I am
suggesting

"Dan Sikorsky" wrote:
I have one parameter which I get in the Page_Load event from
Request.Serverv ariables("LOGON _USER"), and have verified that it is set to a
loginid.
>
I store this loginid in a Property that stores the value in the ViewState.
>
I use a TextBox control that has a style=display:n one, and a Text value set
to the Property.
>
Finally, I have a SqlDataSource SELECT control parameter set to the TextBox
control.
>
Should I use the Page_PreRender event instead?
>
--
Thank you kindly,
>
Dan Sikorsky BA, BSCE, MCS
>
>
"Sean" wrote:
>
chances are you havent set up a default value for your parameter and/or set
it to a control/querystring etc etc.

so when the grid loads it wants a value for its parameter question becomes
where does it get it from?


"Dan Sikorsky" wrote:

When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE, the
GridView tied to the SqlDataSoure is empty.
>
How do I get this working?
>
--
Thank you kindly,
>
Dan Sikorsky BA, BSCE, MCS
Jul 29 '06 #8
Post your problem and let me know where it is; I'll take a look at it.

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Sean" wrote:
Then I am at a loss other then perphaps that userid doesnt exist in the
database.
Naturally it might be that the user value simply doesnt exist in the table
but as you say you already tried it out generating a query.

I am currently investigating very mysterious problems I am having with the
SQLDatasource control referencing sproc signatures that no longer exist. Its
been very troubling.

"Dan Sikorsky" wrote:
I put a breakpoint on the SqlDataSource OnSelecting event and the
e.Command.Param eters[0] says the loginid is there; so it is being passed to
the Stored Procedure.
--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Sean" wrote:
I think you are on the right track when thinking about the page lifecycle.
I think your best bet would be one of the events of the SQLDataSource
control or the gridview control istelf.
Perhaps the gridviews databinding event.
Also maybe you could access the Requesti.Server variables("LOGI N_USER")
directly instead of pasing it to another control. If you follow what I am
suggesting
>
"Dan Sikorsky" wrote:
>
I have one parameter which I get in the Page_Load event from
Request.Serverv ariables("LOGON _USER"), and have verified that it is set to a
loginid.

I store this loginid in a Property that stores the value in the ViewState.

I use a TextBox control that has a style=display:n one, and a Text value set
to the Property.

Finally, I have a SqlDataSource SELECT control parameter set to the TextBox
control.

Should I use the Page_PreRender event instead?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS


"Sean" wrote:

chances are you havent set up a default value for your parameter and/or set
it to a control/querystring etc etc.
>
so when the grid loads it wants a value for its parameter question becomes
where does it get it from?
>
>
"Dan Sikorsky" wrote:
>
When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE, the
GridView tied to the SqlDataSoure is empty.

How do I get this working?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
Jul 31 '06 #9
Fixed.

A string parameter was being passed to the stored procedure as Nothing/Null.
By setting this parameter to "" in the SqlDataSource_O nSelecting event
handler resolved the problem.

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
"Dan Sikorsky" wrote:
When I hit the Test Query button in the SqlDataSource design, all the rows
come back. But when I run the website, without any changes, in the IDE, the
GridView tied to the SqlDataSoure is empty.

How do I get this working?

--
Thank you kindly,

Dan Sikorsky BA, BSCE, MCS
Aug 4 '06 #10

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

Similar topics

3
11279
by: michelle | last post by:
I am trying to get an output value from a stored procedure using sqlDataSource in asp.net 2.0. But I only get a null value for the output. Can someone please help? The sqlDataSource: <asp:SqlDataSource ID="DataSource1" runat="server" ConnectionString="<%$ ConnectionStrings: ConnectionString1 %>" SelectCommand="UserLkp" SelectCommandType="StoredProcedure"
3
5152
by: mahajanvit | last post by:
Hi one and all I got this problem during my project. So in order to solve this I made a very small application. I am trying to insert using SP and sqldatasource control. I know that while using sqldatasource control, there is no need of opening and closing a connection. Also there is no need to write connection string. When i am selecting table from sqldatasource and writing insert statement in C# code, its working fine. When I am...
0
2249
by: Brew | last post by:
Hello, I'm writing an ASP.NET 2005 (VB) Website with an Oracle 9i backend I have an oracle package with stored procedures and functions I need to use from the VB Code, I'm trying to use the SQLDataSource to call a stored procedure passing parameters and then displaying the results on a GridView control my trouble is with the parameters and displaying results into the GridView.
1
6850
by: ryanb31 | last post by:
When I call databind on my gridview which uses a SqlDataSource as its DataSourceID, after 30 seconds I get the error "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." I have tried the Connect/Connection TimeOut property in my connection string and have used values between 0 and 600 and it has had no affect. I can run the stored procedure through Query Analyzer. It...
0
2140
by: george | last post by:
Hi world! Anyone experienced building gridview in Oracle environment using stored procedures, please help! Right now, I have issues using Oracle SP, I spent a whole day on this and still cannot get the results back, so shamelessly turn to you for help! OK, the web page part of SqlDataSource is defined as: <asp:SqlDataSource ID="SqlDataSource4" runat="server"
4
2598
by: Wannabe | last post by:
I am using ASP.Net 2.0 and have a gridview on my page. I have everything working except the delete command. The page reloads except the row I am trying to delete is still there. I believe it is something really easy, but I cannot see it. The stored procedue works when run in QA. Can someone tell me what I am doing wrong/missing that is keeping the delete command from working in the gridview? Thank you. I am trying to delete a row out of...
1
6125
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some label,textboxs,dropdownlists,radiobutton and checkbox asp standard controls. On the click event of the command button the data gets stored into the database. I have created the stored procedures for the insert,update,delete. I have...
12
4701
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that variable in the url. I would like that variable to trigger a stored and
0
1747
by: =?Utf-8?B?X3ByZWZpeA==?= | last post by:
Hello All, I have written a page with a sqlserverdatasource control and a formview web control. I want to use stored procedures to perform CRUD operations. Formview textboxes bind to table columns to present the data for direct table operations, but textboxes do not bind with the stored procedure parameter name in any simple way. I don’t have an problem with creating and deleting a row because inserting
0
8392
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, 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...
0
8305
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,...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
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 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...
0
7321
agi2029
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...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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
2
1607
bsmnconsultancy
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...

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.