By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

Using Stored Procedure in SqlDataSource Won't Workd

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
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*********@discussions.microsoft.comwrote in message
news:CB**********************************@microsof t.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

P: n/a
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

P: n/a
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*********@discussions.microsoft.comwrote in message
news:CB**********************************@microsof t.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

P: n/a
I have one parameter which I get in the Page_Load event from
Request.Servervariables("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:none, 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

P: n/a
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.Servervariables("LOGIN_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.Servervariables("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:none, 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

P: n/a
I put a breakpoint on the SqlDataSource OnSelecting event and the
e.Command.Parameters[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.Servervariables("LOGIN_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.Servervariables("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:none, 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

P: n/a
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.Parameters[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.Servervariables("LOGIN_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.Servervariables("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:none, 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

P: n/a
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.Parameters[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.Servervariables("LOGIN_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.Servervariables("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:none, 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

P: n/a
Fixed.

A string parameter was being passed to the stored procedure as Nothing/Null.
By setting this parameter to "" in the SqlDataSource_OnSelecting 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 discussion thread is closed

Replies have been disabled for this discussion.