Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <asp:DropDownList ID="DropDownList1" runat="server"
- DataSourceID="A" DataTextField="Regisno" DataValueField="Regisno">
- </asp:DropDownList>
- <asp:AccessDataSource ID="A" runat="server" DataFile="~/App_Data/Database.mdb"
- SelectCommand="SELECT [Regisno] FROM [tblsignupv] WHERE ([Email] = ?)">
- <SelectParameters>
- <asp:SessionParameter Name="Email" SessionField="User" Type="String" />
- </SelectParameters>
- </asp:AccessDataSource>
- DropDownList1.SelectedValue="123";
- SqlCommand comm = new SqlCommand();
- comm.Connection = new SqlConnection("Data Source=(local);Initial Catalog=[db];user=[user];password=[pwd];");
- String sql = @"SELECT [Regisno] FROM [tblsignupv] WHERE ([Email] = '[emailaddress]')";
- comm.CommandText = sql;
- comm.Connection.Open();
- SqlDataReader cursor = comm.ExecuteReader();
- while (cursor.Read())
- {
- // add your option to the combobox here
- customerID.Items.Add(new ListItem(cursor["text"].ToString(), cursor["value"].ToString()));
- }
- comm.Connection.Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement