Using @column = [column] SQL Server 2000

Should the following select statement return ALL the records including the records where [district] is null?  Currently it is only returning non null records.  I tried it with a default value and without with the same results.

SelectCommand="SELECT [ID], [last], [first], [district], [TA] FROM [regd] Where ([district] Like case when @district is null then [district] else @district end)"

<SelectParameters >
<asp:ControlParameter ControlID="Last_textbox" Name="district" defaultvalue="%" PropertyName="Text" Type="String" />
</SelectParameters>



regards
Milton
0
miltonsnider
11/20/2007 5:17:59 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

3 Replies
726 Views

Similar Articles

[PageSpeed] 16

Try this:

"SELECT [ID], [last], [first], [district], [TA] FROM [regd] Where ([district] Like @district) or @district is null"


Brian

"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4).
0
bmains
11/20/2007 5:31:38 PM

I am not searching for @district is null, I am trying to include the records in the db where [district] = is null and they are not included with the following select statement:
SelectCommand="SELECT [ID], [last], [first], [district], [TA] FROM [regd] Where ([district] Like case when @district is null then [district] else @district end)"



regards
Milton
0
miltonsnider
11/20/2007 5:58:23 PM

I'm not sure if you are looking for an exact match or a "begins with".  If you are looking for a "begins with":

Remove the defaultvalue from the textbox control.  Change the SqlDatasource's property "CancelSelectOnNullParameter" to false.

change the where clause to: WHERE (([district] LIKE @district+'%') OR (@district IS NULL))

 

If you are looking for an exact match (Except when not supplied, then no filter should be applied:

Remove the defaultvalue from the textbox control.  Change the SqlDatasource's property "CancelSelectOnNullParameter" to false.

Change the where clause to: WHERE (([district]=@district) OR (@district IS NULL))

0
Motley
11/20/2007 6:37:33 PM
Reply:

Similar Artilces:

Need query to get distinct column name and details based on that column using sql server 2000
hi, iam having three tables as shown below table 1                                                      table 2                                     &...

This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers
When I connect SQL Server 2005 to a remote database i get the error: "This version of Microsoft Sql Server Management Studio can only be used to connect to Sql Server 2000 and Sql Server 2005 servers". Can I confirm it is because: the remote db is of SQL Server 2008? There is a soln mentioned in http://forums.asp.net/t/1324047.aspx Did anybody try this (installing 2008 express: http://www.microsoft.com/express/sql/download/)? I am just checking again, whether it will disturb my existing SQL Server installation, in any means...? Though it is mentioned that it will g...

how to fetch column using column index in sql server.
Hi, I have several columns in my table, but I want to fetch data using column index instead of column name in select  command. is there any way to do this.Please remember to click “Mark as Answer” on the post that helps youJasim AkhtarNew Delhi ( INDIA ) Yes there is.It's called dynamic SQL and it's a complicated process.See http://www.sommarskog.se/dynamic_sql.html Please click "Mark as Answer" if my reply solved your problem.CheersRammohan...

Using Linq to SQL to insert into an SQL Server XML column
I'm getting an error on this line: ' auditData.PCAuditDataXML = Xdoc.Element("Model") 'Can anyone see where I'm going wrong here?    Private Sub insertDataIntoAuditDataTable(ByVal userName As String, ByVal computerName As String, ByVal Xdoc As XDocument)        Dim ADDC As AuditDataDataClassesDataContext = New AuditDataDataClassesDataContext        Try            Dim auditData As New AuditData_ad     ...

SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)?  Thanks, Azam HighOnCodingWanna get high! Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...

Problem in using sqlbulkcopy to insert data from datatable(no identity column) into sql server table having identity column
Hi, I am having problem in bulk update of a sql server table haning identity column from a datatable( has no identity column) using sqlbulkcopy. I tried several approaches, but it does not show any error nor is the table getting updated. But the identity value seems to getting increased every time. thanks. varun Hmmmm...that means it is inserting something...I wonder if your datatable has data in it. Can you check that?Thanks,MaxLet Me Google That For You! The first thing i did was checked it. The datatable is getting populated fine. What could possibly be wrong si...

SQL Server 2005 Installation problems with SQL Server Express & SQL Server 2000
Hi Guys, I have had SQL Server Express and Sql Server Management Studio Express installed on my machine for some time and recently tried to install a trial of SQL Server 2005 as well.  (Yes, I'm migrating from Visual Studio Express to Visual Studio Professional, just as in tended!) Everything went fine except that nothing seemed to be installed.  I searched in all the obvious places - both on the Start/Programs menu and on the hard-drive: nothing. A check under Add/Remove Programs showed that Sql Server 2005 Express was installed, but called SQL Server 2005. So after a number o...

Can I use Bugzilla with Sql server 2000 or sql server 2005 as backend Database
I have Just Successfully installed Bugzilla My installation are Bugzilla 2.2 Apachec Webserver ActivePerl 7.8 Mysql 5.0 Now I like That My Database should be Sql server 2000 or sql server 2005 Can I do that [As I also see that I required some Perl module of Mysql as well] ...

Is Microsoft free* elearning for Sql Server 2005 useful for learning SQL Server 2000?
I'm working towards MCAD and as elective I want to do the SQL Server course. The exam is on SQL Server 2000.  I was just wondering whether the online course that Microsoft currently have a available for free at https://www.microsoftelearning.com/sqlserver2005/default.aspx would be useful and applicable to SQL Server 2000, or whether it is sufficiently different product to make it confusing to use this as a learning resource. Also if anyone can point me toward any webcasts for SQL Server that would be great. I listened to Fritz Onion's 15 part series when I studied  for my ASP...

SQL Server 2000 and SQL Server 2005 in the same server
Can enyone please send me a link to a white paper explaining how to run both SQL Server 2000 and 2005 in the same machine?Thanks. I don't know about the white paper but I had both running on my machine for a while by making the SQL 2000 a named instance. So for SQL 2005 connection strings my server name was (local) while for SQL 200 using the named instance it was (local)\joesql where joesql was the instance nameHope it helps,Joe http://www.joeaudette.comhttp://www.mojoportal.com...

Using Visual Studio 2003 with sql server 2000 and planning to switch to sql server 2005
We have a project already developed iusing VS 2003 Enterprise architect edition using sql server 2000(have lots of table and stored procs etc.) Now planning to switch to Sql server 2005 are there any issues associated with the switch.   I mean front end programming wise asp.net and vb.net front end codes do they work straight away or need to make any changes to all the front end codes, we are using datasets, data readers calling stored procs and also using lot of hash tables and XML object to make bulk loads to sql server via sqlxml3.0 sp3. Please help thank you very much for the in...

Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?  <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %> <html> <head> <%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%> <title>Login History</title> </head> <body style="margin:0 0 0 0;padding:0 0 0 0"> ...

SQL Server 2000 Developer vs SQL Server 2000 Standard
I have installed the SQL Server 2000 developer that came with Office XP Developer. I now have a copy of SQL Server 2000 Standard. What will happen if I try to install the standard version? Will I loss any of my current database logins or settings, etc...? Thank you for any help,Thank youJackxxx Upgrading your version of SQL Server 2000 should not result in the loss of any information that you already have set up. I believe you can/should choose "Upgrade, remove, or add components to an existing instance of SQL Server" when you go to install SQL Server 2000 Standard. TerriT...

Using SQL Server 2000 instead of SQL Express
Hi,     I'm a newbie at trying out ASP.NET 2.0, what i wanted to know is for the Login and other controls which depend on SQL Express / 2005 as the database, can i reroute the connection string to point to SQL Server 2000 and for the controls and use a SQL 2000 database instead of SQL Express / 2005, if so is there any documentation available where i could learn more. Thanks Go into:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215type "aspnet_regsql" and it'll walk you through a wizard to setup a SQL2000 database for usage"If you make it idiot proof, they'...

Web resources about - Using @column = [column] SQL Server 2000 - asp.net.sql-datasource

Politics, Political News - The Capitol Column
Covering the politics of science, technology, business, entertainment, Capitol Hill, and health.

Column vector - Wikipedia, the free encyclopedia
... unclear because it lacks inline citations . Please improve this article by introducing more precise citations. In linear algebra , a column ...

Column 8
More on the pointless &quot;rebranding&quot; of passengers as &quot;guests&quot; and other labelling gymnastics (Column 8, for some days), from ...

Column 8
Ah, Boxing Day &ndash; when the ruins of Yuletide feasts and ransacked cellars are flensed&#8203; and gargled, cricketers and sailors bake in ...

Price Drop: Column Division
Column Division 3.0 Device: iOS Universal Category: Education Price: Free, Version: 3.0 ( iTunes ) Description: This math app can be used ...

This Column Nails It
“ How Racists Talk About Tamir Rice “: For as long as I’ve been a newspaper columnist — 13 years and counting — I’ve been on the receiving end ...

Patt Rall Column: The arts and Bemidji go hand in hand
Bemidji Pioneer Patt Rall Column: The arts and Bemidji go hand in hand Bemidji Pioneer Watching Bridget O' Sullivan fulfilling her ambition ...

Tim O'Sullivan column: Edelman's return comes just in time for Patriots
Concord Monitor Tim O' Sullivan column: Edelman's return comes just in time for Patriots Concord Monitor Yes, New England was also playing ...

Philly high schooler gets lesson in hate after penning column on Missouri race friction
Philadelphia High School student Michael Moroz was prepared for backlash over his op-ed that ran in the school newspaper, but what he didn’t ...

Column: Moving Semifinals to New Year's Eve a Total Flop
The College Football Playoff is a marvelous thing. The timing of the national semifinal games? Boy, did they get that one wrong. The Orange Bowl, ...

Resources last updated: 1/14/2016 10:50:21 AM