Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2006, 04:04 PM
Registered User
 
Join Date: Nov 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default change SelectCommand of an SQLDataSource

To cut a long story short:

this: "SELECT * FROM Products" is my defalt select command of SqlDataSource1.

I write code like this: SqlDataSource1.SelectCommand = "SELECT ItemID FROM Products";

It really works, but only until page's refreshed.

So, what can I do to make the change of a select command constant?



, thanks.
 
Old March 16th, 2007, 04:39 PM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to dbys
Default

I'm having the same problem. Please let me know if you find a solution.

Thanks

 
Old March 18th, 2007, 10:42 AM
Authorized User
 
Join Date: Feb 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Q1) Is it in the load event of the page?
Q2) VB of C#
Q3) Can you show the code around it please?


 
Old July 24th, 2007, 11:20 AM
Registered User
 
Join Date: Jul 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi fewer,
have you found the solution to the following problem that you faced?
i am also having the same problem. any help would be greatly appreciated.
Quote:
quote:Originally posted by fewer
 To cut a long story short:

this: "SELECT * FROM Products" is my defalt select command of SqlDataSource1.

I write code like this: SqlDataSource1.SelectCommand = "SELECT ItemID FROM Products";

It really works, but only until page's refreshed.

So, what can I do to make the change of a select command constant?



, thanks.

 
Old July 26th, 2007, 03:20 AM
Authorized User
 
Join Date: May 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to DarkForce
Default

ok people this ishowit works.
first solution is, change the string in the page load event.
if you change it there the last string is the string used by the compiler.
you can also make a change to the code by event handling.
if you navigatefrom site to site use session variables to maintain current strings.

Ivan





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLDatasource cymerman ASP.NET 1.0 and 1.1 Basics 1 February 28th, 2008 12:38 AM
sqldatasource imjayakumar ASP.NET 2.0 Professional 3 May 21st, 2007 01:56 PM
sqldatasource imjayakumar Crystal Reports 0 May 19th, 2007 03:12 AM
sqldatasource imjayakumar ASP.NET 2.0 Professional 0 May 19th, 2007 02:58 AM
SQLDataSource bmains ASP.NET 2.0 Basics 1 December 19th, 2004 09:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.