473,769 Members | 3,329 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select statement

VJ
SELECT [Department], [Last_Name], [First_Name], [Title], [Extension]
FROM [temployees] WHERE (([Department] = @Department) OR ([First_Name]
LIKE '%' + @First_Name + '%'))

this is my sql statement on my GridView but I can't get the values to
display?

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Mar 30 '06 #1
7 1301
Are you getting an error? Do other sql statements on other gridviews
work? How are you passing in those parameters? Do hard-coded sql
statements work?

Mar 30 '06 #2
Show some snippet code and you will get an answer
Patrick

"VJ" <vn****@hotmail .com> wrote in message
news:Oq******** ******@TK2MSFTN GP09.phx.gbl...
SELECT [Department], [Last_Name], [First_Name], [Title], [Extension]
FROM [temployees] WHERE (([Department] = @Department) OR ([First_Name]
LIKE '%' + @First_Name + '%'))

this is my sql statement on my GridView but I can't get the values to
display?

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

Mar 31 '06 #3
This is my sqldatasource.. ...

<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:dbPMAEventsC onnectionString %>"
SelectCommand=" SELECT [Department], [Last_Name], [First_Name],
[Title], [Extension] FROM [temployees] WHERE (([Department] =
@Department) OR ([First_Name] LIKE '%' + @First_Name + '%'))">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="dpdD epartment"
Name="Departmen t" PropertyName="S electedValue"
Type="String" />
<asp:FormParame ter FormField="txtF irstName"
Name="First_Nam e" Type="String" />
</SelectParameter s>
</asp:SqlDataSour ce>
but the gridview gives me NO data at all

<asp:GridView ID="GridView1" runat="server"
AutoGenerateCol umns="False" DataSourceID="S qlDataSource2"
Font-Names="Arial" Font-Size="Smaller" Style="z-index: 109;
left: 140px; position: absolute;
top: 314px" Width="800px">

thanks
v

Mar 31 '06 #4
Have you tried your SQL statement using Query Analyzer?
Pls do that and is it possible to move your Sql statement to a stored
procedure
PAtrick
<vn****@hotmail .com> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.com...
This is my sqldatasource.. ...

<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:dbPMAEventsC onnectionString %>"
SelectCommand=" SELECT [Department], [Last_Name], [First_Name],
[Title], [Extension] FROM [temployees] WHERE (([Department] =
@Department) OR ([First_Name] LIKE '%' + @First_Name + '%'))">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="dpdD epartment"
Name="Departmen t" PropertyName="S electedValue"
Type="String" />
<asp:FormParame ter FormField="txtF irstName"
Name="First_Nam e" Type="String" />
</SelectParameter s>
</asp:SqlDataSour ce>
but the gridview gives me NO data at all

<asp:GridView ID="GridView1" runat="server"
AutoGenerateCol umns="False" DataSourceID="S qlDataSource2"
Font-Names="Arial" Font-Size="Smaller" Style="z-index: 109;
left: 140px; position: absolute;
top: 314px" Width="800px">

thanks
v

Apr 1 '06 #5
Sorry, can't help you if you don't answer my original questions.

Apr 3 '06 #6
You can't use an expression in the select statement

you'll have to take out the "+" signs

Apr 3 '06 #7
er, you can't use an expression in the declarative property of the
sqldatasource i mean

Apr 3 '06 #8

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

Similar topics

21
5259
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All works as expected. But >>> numb=10 >>> cursor.execute("SELECT * FROM mytest where clientID = %d",numb) Traceback (innermost last): File "<stdin>", line 1, in ?
0
10211
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the database table, using dynamic sql. Executing 'EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;' the error code -2149 is returned That means "Specified partition does not exist". Does anybody know if it is a database problem or a problem of
3
5727
by: dumbledad | last post by:
Hi All, I'm confused by how to replace a SELECT statement in a SQL statement with a specific value. The table I'm working on is a list of words (a column called "word") with an index int pointing to the sentence they come from (a column called "regret"). I also have a table of stop words (called "GenericStopWords") that contains the words I do not want to consider. That table has a single column called "word". I started off using a...
4
2255
by: 001 | last post by:
Hello, The select statement needs only 1 second to complete the query. But the update statement spends 30 minutes. Why? SELECT STATEMENT: declare @IDate smalldatetime select @IDate=col001 from USDay select * from USDay A
3
6472
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I COULD be wrong... :) I've tried the access group...twice...and all I get is "Access doesn't like ".", which I know, or that my query names are too long, as there's a limit to the length of the SQL statement(s). But this works when I don't try to...
1
3689
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into "access_log", the referential integrity triggers generate these queries: SELECT 1 FROM ONLY "public"."application_type" x
6
13764
by: Bob Stearns | last post by:
I am getting duplicate rows back from a select distinct statement of the form: SELECT DISTINCT 'jhough', '000111', t0.bhid FROM (SELECT lots of good stuff) t0 LEFT OUTER JOIN another_table t1 ON relevant_stuff WHERE (lots of conditions) After re-reading the relevant pat ofVol 1 of the SQL Reference I am unablee to see how this is possible.
19
8384
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without FOR UPDATE, it is fine and no error. I also tried Set objRs = objConn.Execute("SELECT * FROM EMP UPDATE OF EMPNO"), but it still couldn't help. any ideas? I tried to search in the web but couldn't find similar
1
21687
by: microsoft.public.dotnet.languages.vb | last post by:
Hi All, I wanted to know whether this is possible to use multiple variables to use in the select case statement such as follows: select case dWarrExpDateMonth, dRetailDateMonth case "01" : dWarrExpDateMonth="Jan" : dRetailDateMonth="Jan" case "02" : dWarrExpDateMonth="Feb" : dRetailDateMonth="Feb" End Select
0
5630
FishVal
by: FishVal | last post by:
Hereby I'm proposing a way of convinient work with properties containing SQL Select statements, particulary RowSource property of ComboBox and ListBox. The usual way is the following. Private Sub Combo1_AfterUpdate() Me.Combo2.RowSource = "SELECT ... FROM ... WHERE Table2.keyID=" & Me.Combo1 & ";" Combo2.Requery
0
10045
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...
1
9993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
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...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
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
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.