473,386 Members | 1,710 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,386 software developers and data experts.

Using Parameters within SqlDataSource Object--Need Help~

Good evening friends,

I have added a Drop Down List box control to my web form.
The table contains 3 fields :

LanguageID
ProvinceID
Province

I have also added a SqlDataSource object and configured it to retrieve
Provinces based on my parameter named @languageID

<asp:DropDownList ID="ddlProvince" runat="server"
DataSourceID="ProvSqlDataSource"

DataTextField="province" DataValueField="province" Width="196px">

</asp:DropDownList></td>

<asp:SqlDataSource ID="ProvSqlDataSource" runat="server"
CacheExpirationPolicy="Sliding"

ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"

SelectCommand="SELECT DISTINCT [province] FROM [provinces] WHERE
([languageID] = @languageID ) ORDER BY [province]">

</asp:SqlDataSource>

If I dump the following:
SelectCommand="SELECT DISTINCT [province] FROM [provinces] WHERE
([languageID] = '1') ORDER BY [province]">

it works however, I need to find a way to gain access to the @LanguageID
parameter.


My problem is how I may gain access to the @languageID parameter. I feel
kinda stoopid, as this may be an easy solution.

It has to change either "1" for English and "2" for French,,,

Depending on the language chosen for the web form page. So I use this code
to retrieve the language chosen by the user.

<%
Dim languageSuffix, altlang, lang As String

Dim langID As Int32

lang = Request.QueryString("lang")
If Request.QueryString("lang") = "" Then

lang = "en"

End If

'Response.Write("<br />The Lang is--" & lang)
If (lang = "fr") Then

langID = 2

altlang = "fr"

Else ' lang = "en"

langID = 1

altlang = "en"

End If
Response.Write(("<br />The LangID is--" & langID))
%>

But I cannot for the life of me figure out how to gain access to the
@languageID and add 1 if English or 2 if French.
Any ideas, code examples or urls would be greatly appreciated,

Thanks in advance

~Brad

--
------------------------------
Brad Isaacs
Developer, Consultant
www.webdevcreations.com
bi*****@rogers.com
Jan 30 '07 #1
0 836

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

Similar topics

3
by: Jon Maz | last post by:
Hi, A quick one: If you are forming a dynamic sql statement using parameters from a web form, you would normally double up any single inverted commas inputted by the user to stop sql...
1
by: Mark | last post by:
Hi: I have an access db that I'm accessing via ASP.Net. I'm using WebMatrix's wizard to write the tedious db query code using parameters. Select, insert, and delete work fine using the database...
1
by: Tor Inge Rislaa | last post by:
Using PowerPoint within my application I am developing an application that needs some functionality of displaying some text and graphic in full screen modus, as when you run a PowerPoint show....
3
by: Wayne Wengert | last post by:
Using VSNET2005. I want to insert some rows into a table. Each row has 2 columns, "memberid" which is a GUID and "Interests" which is a varchar. I created a SQLDataSource with the values to insert...
3
by: Kees de Winter | last post by:
Hi, I am trying to set a parameter in the SELECT statement of a SqlDataSource, in the Page_Load event where the intended value for the parameter is calculated. But how can I set the parameter to...
3
by: Daniel R. H. | last post by:
Hi, I'm having problems to get the value of a Querystring into the SelectCommand of a SQLDataSource, here's my code: ---------------------------------------------- <asp:SqlDataSource...
3
by: Tor Inge Rislaa | last post by:
Passing and using parameters How to get hold of the parameter value provided by the URL? When I open a web form with a DataSource I often include a parameter in the URL as below: ...
3
by: duyanning | last post by:
I have written a pyhton script that will process data file in current working directory. My script is in an different directory to data file. When I debug this script using pdb within emacs, emacs...
3
by: Ilyas | last post by:
Hi all What is the recommended way for using Linq within a 3 Tier project? Many thanks
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.