navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Database query

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Expression Web Help >> Database query
Page: [1]
 
Trandel

 

Posts: 117
From: Johannesburg South Africa
Status: offline

 
Database query - 3/26/2008 10:27:25   
Hi,

I have got a dropdown list working for a Gridview with an Access database. The dropdown list is populated from the same table as the gridview.

Now I want to do:

1. Use a dropdown list populated from a master table of towns to find records in the detail table.

2. I also need to be able to look for the dropdown list argument in either one of two fields in the detail record.

i.e. The master table has details of all suburbs and towns. The detail record has two fields for them but sometimes the town is placed in the suburb field. (the Zip Code identifies the suburb)

From what I can see the dropdown list has to be on the same field as the the gridview?

I have tried the dropdown list with its datasource pointing to the master table and the gridview pointing to the detail table but get no response. As far as two items in the select clause go there does not seem to be an OR facility available.

Any ideas extremely welcome as I am going around in circles.

Regards

Tony Randell

< Message edited by Trandel -- 3/26/2008 10:41:38 >
rdouglass

 

Posts: 9167
From: Biddeford, ME USA
Status: offline

 
RE: Database query - 3/28/2008 9:05:37   
quote:

and the gridview pointing to the detail table but get no response.


I don't use EW but I do use VS and that uses the Gridviews and such so things should be similar.

Is your Gridview datasource using the Dropdown as a query parameter? The code should look something like this. (This is exactly as on one of my live pages):

<asp:SqlDataSource ID="ds_ServiceTypes" runat="server" ConnectionString="<%$ ConnectionStrings:SF %>"
SelectCommand="SELECT [ServiceTypeID], [ServiceType] FROM [tlkp_ServiceTypes] WHERE ([ServiceTypeTypeID] = @ServiceTypeTypeID) ORDER BY [ServiceType]">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" DefaultValue="0" Name="ServiceTypeTypeID"
PropertyName="SelectedValue" Type="Int64" />

</SelectParameters>
</asp:SqlDataSource>

See the bold line? That's the one that says 'use the dropdown'. Does yours look any thing like that?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Trandel)
Trandel

 

Posts: 117
From: Johannesburg South Africa
Status: offline

 
RE: Database query - 3/29/2008 1:13:08   
Thanks for your reply.

I have got the dropdown to work now. It looks up a master table and selects detail records from their own table. The code you referred to in my app is:

<asp:AccessDataSource runat="server" ID="AccessDataSource2" DataFile="App_Data/saqcc.mdb" SelectCommand="SELECT [Initials], [Surname], [Employer], [Suburb], [SubDesc], [Town] FROM [AP-Details] WHERE ([Suburb] = ?)">
<SelectParameters>
<asp:controlparameter PropertyName="SelectedValue" Type="String" Name="Suburb" ControlID="DropDownList1" />
</SelectParameters>
</asp:AccessDataSource>


What I would like to be able to do now is to search the town column as well as the suburb col with the same value from the dropdownlist?


(in reply to rdouglass)
rdouglass

 

Posts: 9167
From: Biddeford, ME USA
Status: offline

 
RE: Database query - 3/30/2008 8:18:13   
quote:

What I would like to be able to do now is to search the town column as well as the suburb col with the same value from the dropdownlist?


I don't think I'm clear. Are you saying you want that data source to search using 2 different dropdowns as the criteria items?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Trandel)
Trandel

 

Posts: 117
From: Johannesburg South Africa
Status: offline

 
RE: Database query - 3/30/2008 14:18:53   
Hi,

I want to search two diffferent columns from the single dropdown argument. e.g. look for New York in both suburb and town.

Regards

T

(in reply to rdouglass)
rdouglass

 

Posts: 9167
From: Biddeford, ME USA
Status: offline

 
RE: Database query - 3/30/2008 14:58:36   
quote:

<asp:AccessDataSource runat="server" ID="AccessDataSource2" DataFile="App_Data/saqcc.mdb" SelectCommand="SELECT [Initials], [Surname], [Employer], [Suburb], [SubDesc], [Town] FROM [AP-Details] WHERE ([Suburb] = ?)">
<SelectParameters>
<asp:controlparameter PropertyName="SelectedValue" Type="String" Name="Suburb" ControlID="DropDownList1" />
</SelectParameters>
</asp:AccessDataSource>


Something like this maybe?

<asp:AccessDataSource runat="server" ID="AccessDataSource2" DataFile="App_Data/saqcc.mdb" SelectCommand="SELECT [Initials], [Surname], [Employer], [Suburb], [SubDesc], [Town] FROM [AP-Details] WHERE ([Suburb] = @Suburb) OR ([Town] = @Suburb)">
<SelectParameters>
<asp:controlparameter PropertyName="SelectedValue" Type="String" Name="Suburb" ControlID="DropDownList1" />
</SelectParameters>
</asp:AccessDataSource>

See what I did? Since we're using the same dropdown, I really didn't need to define a second select parameter but rather just reused it in the query.

Does that help any?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Trandel)
Trandel

 

Posts: 117
From: Johannesburg South Africa
Status: offline

 
RE: Database query - 3/31/2008 1:45:54   

Hi

Thanks a ton - it works just great. I didnt realise that I could change the ? to an @name.

Regards

T

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> Expression Web Help >> Database query
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts