Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <asp:DropDownList ID="DropDownList1" runat="server"
  2. DataSourceID="A" DataTextField="Regisno" DataValueField="Regisno">
  3. </asp:DropDownList>
  4.  
  5. <asp:AccessDataSource ID="A" runat="server" DataFile="~/App_Data/Database.mdb"
  6. SelectCommand="SELECT [Regisno] FROM [tblsignupv] WHERE ([Email] = ?)">
  7. <SelectParameters>
  8. <asp:SessionParameter Name="Email" SessionField="User" Type="String" />
  9. </SelectParameters>
  10. </asp:AccessDataSource>
  11.  
  12. DropDownList1.SelectedValue="123";
  13.  
  14. SqlCommand comm = new SqlCommand();
  15. comm.Connection = new SqlConnection("Data Source=(local);Initial Catalog=[db];user=[user];password=[pwd];");
  16. String sql = @"SELECT [Regisno] FROM [tblsignupv] WHERE ([Email] = '[emailaddress]')";
  17. comm.CommandText = sql;
  18. comm.Connection.Open();
  19. SqlDataReader cursor = comm.ExecuteReader();
  20. while (cursor.Read())
  21. {
  22. // add your option to the combobox here
  23. customerID.Items.Add(new ListItem(cursor["text"].ToString(), cursor["value"].ToString()));
  24. }
  25. comm.Connection.Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement