Google Community
Latest Forums Rules Resources
Custom Search

Go Back   Google Community > Webmaster Forums > Web Design, Coding & Programming Forum

GoogleCommunity Sponsor
Cirtex Hosting
Use coupon "forum" for 50% Off!

Reply
 
LinkBack Thread Tools Display Modes
Old 03-28-2008, 03:38 AM   #1 (permalink)
Senior Googler
 
Join Date: Jul 2007
Posts: 131
Thanks: 0
Thanked 3 Times in 3 Posts
apg1985 is on a distinguished road
Need a little help with this code please.

Hi, Ive got a dropdownlist which selects stored procedures from SQL and it works fine for 2 but i really want it to have more then 2 has anyone got any ideas? CODE BELOW

SQLConnection =
New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\Animals.mdf;Integrated Security=True;User Instance=True")
SQLCommand =
New SqlCommand
SQLCommand.CommandType = CommandType.StoredProcedure
If DropDownList.SelectedItem.Value = 0 Then
SQLCommand.CommandText = "spcatinsert"
Else
SQLCommand.CommandText = "spdoginsert"
EndIf
apg1985 is offline   Reply With Quote
 
Sponsored Links
Old 04-01-2008, 01:23 AM   #2 (permalink)
Googler
 
Join Date: Mar 2008
Location: India
Posts: 64
Thanks: 0
Thanked 2 Times in 2 Posts
mandava is on a distinguished road
i dont know which language you are programming in.
but i think you can try using either if..elseif..elseif..end statement or probably a switch statement.
mandava is offline   Reply With Quote
Old 04-01-2008, 02:22 AM   #3 (permalink)
Senior Googler
 
Join Date: Jul 2007
Posts: 131
Thanks: 0
Thanked 3 Times in 3 Posts
apg1985 is on a distinguished road
vb.net and your right i used the else statment and it worked fine with no bugs.

Thanks
apg1985 is offline   Reply With Quote
Old 04-01-2008, 02:23 AM   #4 (permalink)
Senior Googler
 
Join Date: Jun 2006
Posts: 148
Thanks: 1
Thanked 4 Times in 4 Posts
alemcherry
You can do more else If ,a s much as you want. I guess you need to learn the programming basics
alemcherry is offline   Reply With Quote
Old 04-01-2008, 03:22 AM   #5 (permalink)
Googler
 
Join Date: Mar 2008
Location: India
Posts: 64
Thanks: 0
Thanked 2 Times in 2 Posts
mandava is on a distinguished road
Quote:
Originally Posted by apg1985 View Post
vb.net and your right i used the else statment and it worked fine with no bugs.

Thanks
no prob. you're welcome.
mandava is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with conversion code - installed by code is not firing rebmyster Google AdWords & AdSense Forum 0 03-04-2008 07:07 AM
These code mean ...? tigerbin Web Design, Coding & Programming Forum 0 01-08-2007 03:15 PM
Google Code: Summer of Code Randy Google and Open Source 6 06-04-2005 11:38 AM
Code? JshLnsctt Web Design, Coding & Programming Forum 9 02-12-2005 06:38 AM
I need help with this bit of code - php pleasant Web Design, Coding & Programming Forum 9 10-31-2004 04:46 AM


All times are GMT -8. The time now is 01:54 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004–2007 Google Community