Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dropdown List

Dropdown List

Scheduled Pinned Locked Moved ASP.NET
databasebusinesshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3738736
    wrote on last edited by
    #1

    I have a webform whereby i use a dropdown list to select fields like title,province etc. but the problem is that when i select a value from the dropdown and click save button,the field in the database becomes blank. my code is as follows: BUSINESS LAYER Public Function GetTitle() As Data.DataSet Dim strSQL As String Dim obj As Datalayer.Database = New Datalayer.Database 'strSQL = "Select * from UserProfile with (nolock) where UserName='" & strUserName & "' and Status = 'A'" strSQL = "Select TitleID, Title from Title1 with (nolock) " GetTitle = obj.GetDataSet(strSQL) obj.Close() Exit Function End Function PRESENTATION LAYER Private Sub LoadTitle() Dim ds As New Data.DataSet Dim objdata As Businesslayer.Contractors = New Businesslayer.Contractors ds = objdata.GetTitle cbotitle.DataSource = ds cbotitle.DataBind() cbotitle.Items.Add(New ListItem("Select...", "")) cbotitle.Items.Item(cbotitle.Items.Count - 1).Selected = True End Sub BUTTON SAVE Dim obj As Businesslayer.Contractors = New Businesslayer.Contractors Dim ds As Data.DataSet ds = obj.Getcontractor(txtfirstname.Text) obj.AddContractor(txtID.Text, cbotitle.SelectedItem.Value, cbogender.SelectedItem.Value, txtfirstname.Text, txtlastname.Text, _ txtIDNumber.Text, txttel.Text, txtcell.Text, txtfax.Text, txtemail.Text, _ cbodepartment.SelectedItem.Value, txtlocation.Text, txtcity.Text, txtpostal.Text, txtoccupation.Text, cbomtype.SelectedItem.Value, _ cboprovince.SelectedItem.Value, txtpassport.Text) UserMsgBox("Successfully add") Karabo Mekgwe

    M 1 Reply Last reply
    0
    • U User 3738736

      I have a webform whereby i use a dropdown list to select fields like title,province etc. but the problem is that when i select a value from the dropdown and click save button,the field in the database becomes blank. my code is as follows: BUSINESS LAYER Public Function GetTitle() As Data.DataSet Dim strSQL As String Dim obj As Datalayer.Database = New Datalayer.Database 'strSQL = "Select * from UserProfile with (nolock) where UserName='" & strUserName & "' and Status = 'A'" strSQL = "Select TitleID, Title from Title1 with (nolock) " GetTitle = obj.GetDataSet(strSQL) obj.Close() Exit Function End Function PRESENTATION LAYER Private Sub LoadTitle() Dim ds As New Data.DataSet Dim objdata As Businesslayer.Contractors = New Businesslayer.Contractors ds = objdata.GetTitle cbotitle.DataSource = ds cbotitle.DataBind() cbotitle.Items.Add(New ListItem("Select...", "")) cbotitle.Items.Item(cbotitle.Items.Count - 1).Selected = True End Sub BUTTON SAVE Dim obj As Businesslayer.Contractors = New Businesslayer.Contractors Dim ds As Data.DataSet ds = obj.Getcontractor(txtfirstname.Text) obj.AddContractor(txtID.Text, cbotitle.SelectedItem.Value, cbogender.SelectedItem.Value, txtfirstname.Text, txtlastname.Text, _ txtIDNumber.Text, txttel.Text, txtcell.Text, txtfax.Text, txtemail.Text, _ cbodepartment.SelectedItem.Value, txtlocation.Text, txtcity.Text, txtpostal.Text, txtoccupation.Text, cbomtype.SelectedItem.Value, _ cboprovince.SelectedItem.Value, txtpassport.Text) UserMsgBox("Successfully add") Karabo Mekgwe

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      the field in the database becomes blank.? you mean. the selected value doesn't store in database. some tips. 1. Set the breakpost in Button Save. Check the selected value of combobox. 2. Check whether you got any value (eg: paraProvince) in Businesslayer.Contractors.AddContractor() function. [Make ensure that all values of parameters has been passed from Presentation Layer to BusinessLayer.] 3. Check the SQL Statement.. [Make ensure that all values of parameters has been passed from BusinessLayer to DataLayer.]

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Thank you. :)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups