473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

sqldatasource select where clause .. unexpected behavior???

I have a gridview that times when selecting from specific table when I
try to when I add a where clause. Even when I'm only seleting Top 1
which comes right back at the command line.

I test the below code with two different tables in the datasource for
the gridview, one works the other times out. If I perform the same
query in sql server manually both tables work fine and fast. if I hard
code the where clause in the asp.net the code works fine.

the difference between the tables is that the problem one has Processid
(the select param) as a clustered key index.

If I remove or hard code the where clause the code works fine.

Wondering, is asp.net doing something special when my where clause has
the key in it?

something different about processid is that it's about 30 char long and
contains dashes '-'

<%@ Page Language="VB" AutoEventWireup="false"
MasterPageFile="~/Default.master" Title="Errors" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
runat="Server">
<asp:DropDownList ID="BatchList" runat="server"
DataSourceID="ProcesslDataSource"
DataTextField="ProcessId" DataValueField="ProcessId"
SkinID="DropDownList" AutoPostBack="true">
</asp:DropDownList>
<asp:SqlDataSource ID="ProcesslDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:xxConnectionString %>"
SelectCommand="SELECT Rtrim([ProcessId]) as ProcessId
FROM [x1s_vw]">
</asp:SqlDataSource>
<asp:GridView ID="EntelGridView" runat="server"
AutoGenerateColumns="False" DataSourceID="EntelDataSource"
SkinID="GridView">
<Columns>
<asp:BoundField DataField="ProcessId"/>
</Columns>
</asp:GridView>
<br />
<asp:SqlDataSource ID="xxlDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:x2ConnectionString %>"
selectCommand="select TOP 1 * from x2 where ProcessId =
@ProcessId">
<SelectParameters>
<asp:ControlParameter ControlID="BatchList"
Name="ProcessId" PropertyName="SelectedValue" type=string/>
</SelectParameters>
</asp:SqlDataSource>
<br />

</asp:Content>

Dec 18 '06 #1
0 1604

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

Similar topics

3
by: Hendry Taylor | last post by:
I have a problem where if I issue a select * from against a database it returns no data, but if I select column from it returns the data. Why would the * not be working as a wildcard?
5
by: Martin Bischoff | last post by:
Hi, is it possible to modify the values of a SqlDataSource's select parameters in the code behind before the select command is executed? Example: I have an SqlDataSource with a...
2
by: alain.hogue | last post by:
I have a table "tblCards" with a field "Titre" that contain french words (Hébert, Gagné, Hélène, etc....) in an database with SQLEXPRESS 2005. I have used the asp:SqlDataSource to filter the...
1
by: Henry Habermacher [MVP Access] | last post by:
Environment: VS2005, ASP.Net 2.0, SQLServer 2000, VB.Net, IIS6 I use a GridView Control which is based on a SQLDataSource. The datasource is based on a Select statement and is filtered by the...
2
by: stuart.d.jones | last post by:
Hi, I'm using a detailsview control with an SqlDataSource control. My Update query isn't working, and I've narrowed it down to the optimistic concurrency parameters - i.e. when I comment them...
4
by: Dabbler | last post by:
I need to convert a CompanyId in one table to Company Name from another table for an ItemTemplate. I thought I would just add another SqlDataSource but not sure how to eval with the CompanyId...
33
by: Peter | last post by:
People are telling me it is bad to put select * from <atable> in a view. I better should list all fields of the table inside the definition of the view. I dont know exactly why but some...
1
by: jobs | last post by:
Cannot find column . Am I missing something here... SelectCommand="SELECT , , , refid FROM " FilterExpression="phone_nbr like @phone_nbr + '%'"
3
by: Steven Edison | last post by:
I'm sure this will be a simple one... I have a SqlDataSource that I need a WHERE clause on it ONLY when the querystring contains "ProjectID", otherwise I don't need it. If you come to the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.