Parameter query - spaces in query

Hi:

I am trying to build maste/detail page. 

1.  I have on my page drop down control based on sqldata sources with the concataned fields as follows: 

 SELECT DISTINCT LastName + ' ' + FirstName AS Expr1 FROM dbo.Table1

It displays First Name space and Last name in the box and works fine.

2. I placed on my form a grIdview

In data source I am trying to use parameter filter in SQL select query and the same query as for drop down as follows:

SELECT     LastName + ' ' + SiteFirstName AS Expr1, field1, field2, etc........
FROM         dbo.Table1
WHERE     (LastName + ' ' + FirstName = @filtername)

This query when run without filter shows LastName and SPACES (I believe 25 - field length?) and FirstName.  It should be only one space so it could match the search from my first query.

So when I type values it will not find the record because of the spaces.  Can you help!!   


Anna-Maria
0
Anna
12/4/2007 10:30:17 AM
asp.net.getting-started 91979 articles. 4 followers. Follow

2 Replies
679 Views

Similar Articles

[PageSpeed] 50

u just try this,

select * from (SELECT     LastName + ' ' + SiteFirstName AS Expr1, field1, field2, etc........
FROM         dbo.Table1) as e  where Expr1 = @filtername

0
sarankamal2004
12/4/2007 11:43:57 AM

Thanks so much for your help, I worked with this and then I used trim function and got read of spaces.

 

 


Anna-Maria
0
Anna
12/4/2007 3:35:42 PM
Reply:

Similar Artilces:

C# Ado.net Sql query parameter query
Hi All, I'm trying to pass in a parameter value from an array in a loop that is used in a sql query and the results are populated to an xml file. The trouble is that I'm only getting the colums values in the outputted xml file. So I feel that the paramter is not being read. So can anyone help as I'm really stuck on this one. The code is as follows : public void DisplayUserInfo() { ArrayList UserIdArrayList = IdentifyUserID(); foreach(string ShowUserIDString in UserIdArrayList) { try { SqlConnection SqlConn = new SqlConnection(DBConnString)...

Query a Query
I have a result set in a query. Is it possible to query this query? (no specific SQL dialect, can it be done generically?) Petros -- PETROS GAVRIELIDES wrote: > I have a result set in a query. > Is it possible to query this query? > > (no specific SQL dialect, can it be done generically?) There is a generic answer to your question: Yes, there is a construct called a sub-query that allows you, in 1 SQL statement, to query from a query. But, generically speaking, not all DB engines support this construct. For instance, Firebird only added it just over a y...

How to query a query...
I'm working on converting an Access DB that I created into an ASP.NET application (and attempting to learn ASP at the same time...). One of my queries was very complex and required running a different query first, and then working off of that one. Any suggestions on the best way to do this in ASP? The following is a sample of code I'm using so you can see the type of data-binding I'm using. Thanks for the help! myConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " +"Data Source=" + Server.MapPath("/EquipmentCheckout.mdb")) strS...

Query about Queries
Hello all, As a relatively new user to Sybase I am hoping someone can point me in the right direction. We are getting ready to go live with our database and I am wondering what types of queries I should be running for system performance purposes. If anyone has any suggestions they would be more than appreciated. Thanks in advance, Jerry ...

How to Query A Query
I have been trying to build a crosstab report that reports everydate within a selected range across the top and specific row information. 7/1 7/2 7/3 . . . Name Detail1 Detail2 Detail3 Name Detail1 What I get as output is only the dates that contain information in the rows. I can get the information I need by using a query within a query (nested). Can a nested query be done in Informaker 5? What about version 6 or 7? Thanks for your help Convert your SQL to syntax, and you can write anything you want. So if your DB support...

Getting a value from another query to use it in other queries
I have a datasource query in which i take some values.I am using a listbox so that to show these values.I want to select from the listbox and use this value in other queries as a table to choose from.So in other datasource i am trying to use the syntax SelectCommand="SELECT bla FROM '<%DropDownList1.SelectedValue%>' " but it doesnt seem to work.How can I use the table value from the other query in different way or how can i manage this using the command above ?????Thanx  see it is SELECT bla FROM '<% ListBox1.SelectedValue%>'Jai Ganesh. J , GSD ,I...

Query and Sub-Queries
I have a SELECT statement that has two sub queries in it. The 'where' clause in the main query filters a TRADE_DATE field, for example: ...... where TRADE_DT >= '2003/01/01' and TRADE_DT <= '2003/01/31'. Since I only have one date field(TRADE_DATE), I want the sub-query to query where TRADE_DT <= '2003/01/31'. But its not working. I have to hard code the '2003/01/31'. Now I know I can make a dynamic view in VB, but an ideas of how I can do it in SQL? Here's my statement: select T.BROKER_SEQ_NO,B.BROKER_NAME,B.B...

Query a query in linq
Hi, I have some code that gets some results:var GlobalTable = from p as db.table                             select p; Now I want to run a query in link on the results stored in GlobalTable. Whats the best way to do this? keepin' it real in the ATX. Exactly the way you ran the first query: var GlobalTableSubset = from gt as GlobalTable                        ...

query runs fine in Query Analyser but not the Query Debugger
I'm running a query, actually its an insert that works when using the TSQL below. However when I try to use the debugger to step through and using the exact same values as those below I get the following error: [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification Its Killing me because everything else works, but this. Can somebody help. DECLARE @NoteID INT,-- NULL OUTPUT, @Note_Description NVARCHAR(3000),-- = NULL, @Date DateTime,-- = NULL OUTPUT, @ByWho NVARCHAR(30),-- = NULL, @FK_Action_Performed NVARCHAR(40),...

Query of Queried data
I am new to asp.net after working with coldfusion.  I have created a datagrid from a query of a sql database.  I am interested to know how can I create another datagrid which will process a query of the data in the original grid.  So essentually it is a query of a query. Thank you   You want to filter on the result of the first query? The easiest way I can think of, is to put the data in a datatable, then use the select and dataview features of the datatable. Hi,uusquintsYou can filter the datatable in the code-behind and bind the result to the 2nd datagird:...

Exacute query against query
I have a query which selects all dates from my database between 2 date values which is then entered into my dataset. I thin want to run through the dataset totalling the value of a certain column but only if dates match e.g. 27/02/2007          2.21 27/02/2007          3.10 27/02/2007          2.10                           Tota...

Querying a Queried result...
Hi, is there such a thing as querying a queried result? Example, query 1 produces Result A. Result A's table is stored 'somewhere' to be queried by query 2 which produces Result B If there is, could you kindly direct me to a website with the appropiate article on this topic? Thanks, -Gabian- Yes there is, querying a View is querying a query rewrite. Send me an email the address is in my profile I will send you a Views tutorial I wrote a while back and run a search for query results from View in your BOL(books online) for code samples. Hope this helps. Kind regards, ...

SQLite query and AS in query
This is my code. {code} q := TSQLQuery.Create(nil); try q.SQLConnection := MainForm.sqlite1; q.SQL.Text := sql; q.Open; finally q.Free; end; {code} And this is my SQL select id as _id, name, note as description from notes q.Fields[0].FieldName is id, it should be _id q.Fields[2].FieldName is note, it should be description Is this normal or am I missing something Grega This is frustrating. I can't work at all. http://pretty-software.com/images/xe4.jpg Edited by: grega loboda on Jun 4, 2013 1:40 AM http://stackoverflow.com/question...

Query Plan Query
We have a sql query that is causing a few issues in terms of performance as the optimisor is choosing to table scan where an index will certainly yield significant gains. As proven when snapshotting the query and adding an index hint manually. Unfortunatley since the query is dynamically created by a 3rd party application, we are unable to influence this with index hints and are dependant on the optimiser. The table that is table scanning is partitioned (has also hust been repartitioned to address a slight inbalance across partitions) and has 7.6M records. It has been recently r...

Having trouble querying a query?
I'm trying to transition my reports from Access 2000 into Infomaker 7.0 but I'm having trouble combining two queries together. In Access you had to option of pulling tables or queries as your data, I don't see this option in Infomaker, am I missing something. Thanks from a newbie... IM doesn't have this feature, since it adheres to general Ansi SQL standards. If you show me the Access query, maybe I can give you a workaround. Are you querying an Access DB or a different DB, e.g. Oracle? -- Terry Dykstra (TeamSybase) Please state PB / OS / DB versions in your ...

Web resources about - Parameter query - spaces in query - asp.net.getting-started

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google Webmaster Tools Parameter Handling - Flickr - Photo Sharing!
You aren't signed in Sign In Help Home The Tour Sign Up Explore Explore Home Last 7 Days Interesting Popular Tags Calendar Most Recent Uploads ...

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 2/13/2016 11:05:46 AM