Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Using Parameters within SqlDataSource Object--Need Help~

Reply
Thread Tools

Using Parameters within SqlDataSource Object--Need Help~

 
 
Brad Isaacs
Guest
Posts: n/a
 
      01-30-2007
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

<aspropDownList ID="ddlProvince" runat="server"
DataSourceID="ProvSqlDataSource"

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

</aspropDownList></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
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sqldatasource using a stored procedure with OUTPUT parameters only Andy in South Jersey ASP .Net 3 02-11-2009 02:51 PM
sqldatasource using a stored procedure with OUTPUT parameters only Andy in South Jersey ASP .Net 0 02-11-2009 01:55 PM
sqldatasource using a stored procedure with OUTPUT parameters only Andy in South Jersey ASP .Net 0 02-11-2009 01:53 PM
sqldatasource using a stored procedure with OUTPUT parameters only Andy in South Jersey ASP .Net 0 02-11-2009 01:51 PM
Using parameters with sqldatasource and mySQL tyea ASP .Net 1 08-07-2008 04:25 AM



Advertisments