SELECT Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • markmagill
    New Member
    • Oct 2007
    • 1

    #1

    SELECT Query

    Guys within C# ASP.Net I am trying to generated a Select Query as follows
    where @Email is obtained from a text box.

    What should I be doing next to obtain the results from the query?

    SqlDataSource SQLDataSourceUs ersDB = new SqlDataSource() ;

    SQLDataSourceUs ersDB.Connectio nString = ConfigurationMa nager.Connectio nStrings["ConnectionStri ng"].ToString();

    SQLDataSourceUs ersDB.SelectCom mandType = SqlDataSourceCo mmandType.Text;

    SQLDataSourceUs ersDB.SelectCom mand = "SELECT * FROM Users WHERE Email = @Email";

    SQLDataSourceUs ersDB.SelectPar ameters.Add("Em ail", txtEmail.Text.T oString());
  • JamieHowarth0
    Recognized Expert Contributor
    • May 2007
    • 537

    #2
    Hi Mark,

    Welcome to TheScripts Developer Network!

    I moved your post to the .NET Forum (although users in the ASP Forum can still see the link to your post, as they may be able to answer it, but your question is primarily regarding a .NET environment).

    You may want to read the FAQ for some general guidelines on questions, answers and the forums in general.

    For future reference, you can use ['code] [/'code] tags to encapsulate any computer code that you want to show us. Our forum system will then recognise that particular section of text as code, and even add line numbers so experts and other users can anaylse your code and make appropriate suggestions.

    For VB.NET (which it looks like you're using) the format is:[code=vbnet]'Your VB.NET code here...[/code]

    Once again, welcome to TSDN!

    Cheers,

    medicineworker

    Comment

    • dip_developer
      Recognized Expert Contributor
      • Aug 2006
      • 648

      #3
      Originally posted by markmagill
      Guys within C# ASP.Net I am trying to generated a Select Query as follows
      where @Email is obtained from a text box.

      What should I be doing next to obtain the results from the query?

      SqlDataSource SQLDataSourceUs ersDB = new SqlDataSource() ;

      SQLDataSourceUs ersDB.Connectio nString = ConfigurationMa nager.Connectio nStrings["ConnectionStri ng"].ToString();

      SQLDataSourceUs ersDB.SelectCom mandType = SqlDataSourceCo mmandType.Text;

      SQLDataSourceUs ersDB.SelectCom mand = "SELECT * FROM Users WHERE Email = @Email";

      SQLDataSourceUs ersDB.SelectPar ameters.Add("Em ail", txtEmail.Text.T oString());
      construct a DataAdapter(say da) with the connection and query string.......wi th this Adapter fill a Dataset(say ds)......this dataset will contain all the records...

      [CODE=vbnet] da = new SqlDataAdapter( mySqlQuery, myConnection);
      ds = new DataSet();
      da.Fill(ds, Tablename);
      [/CODE]

      Comment

      Working...