Hi friends,i have one task regarding drop down list.

That is ,I have one registration form, in that i have one CITY drop down list,COUNTRY drop down list.I filled it and the city name ,country name should be loaded in the database.

Now my requirement is,in update form the CITY name,COUNTRY name should come defaultly from database according to the user's registered CITY,COUNTRY name(in drop down list).

please help me, i am new to .net

Recommended Answers

All 2 Replies

u just use a query to retrieve the results
use this query

Dim con As New dbAccess
          str = "SELECT a.Title, a.FirstName, a.FamilyName, a.Fee, f.FeePaid, f.FeeDue, f.Instalments, f.Inst_Amounts, f.Inst_Amounts_updated, f.Inst_Dates, f.Inst_com_paid, f.FeeStatus, f.Inst_Paid_Amount FROM ApplyOnline a, FeeDetails f where a.refno = f.refno and a.refno ='" & Trim(txtstdrefno.Text) & "'"
        con.ds = con.ExeR(str)
        If con.ds.Tables(0).Rows.Count - 1 >= 0 Then
lblStudentName.Text = con.ds.Tables(0).Rows(0).Item(0) & "." & con.ds.Tables(0).Rows(0).Item(1) & " " & con.ds.Tables(0).Rows(0).Item(2)
        txttotfee.Text = con.ds.Tables(0).Rows(0).Item(3)
                  Else
                   End If

taking above as a example u can achieve u r functionality

Hi friends,i have one task regarding drop down list.

That is ,I have one registration form, in that i have one CITY drop down list,COUNTRY drop down list.I filled it and the city name ,country name should be loaded in the database.

Now my requirement is,in update form the CITY name,COUNTRY name should come defaultly from database according to the user's registered CITY,COUNTRY name(in drop down list).

please help me, i am new to .net

Your tables of city, state and country must have a id field. When you are binding the data from the database then bind the value field of drop down to the id field and save the id of state or country in the database. When you edit the record then fetch the record, bind the drop down with all the data(state/country) and write one line
dropdown1.selectedvalue=dt.rows[0]["stateid"].tostring();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.