473,473 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SELECT Query

1 New Member
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 SQLDataSourceUsersDB = new SqlDataSource();

SQLDataSourceUsersDB.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();

SQLDataSourceUsersDB.SelectCommandType = SqlDataSourceCommandType.Text;

SQLDataSourceUsersDB.SelectCommand = "SELECT * FROM Users WHERE Email = @Email";

SQLDataSourceUsersDB.SelectParameters.Add("Email", txtEmail.Text.ToString());
Oct 25 '07 #1
2 1040
JamieHowarth0
533 Recognized Expert Contributor
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:
Expand|Select|Wrap|Line Numbers
  1. 'Your VB.NET code here...
Once again, welcome to TSDN!

Cheers,

medicineworker
Oct 25 '07 #2
dip_developer
648 Recognized Expert Contributor
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 SQLDataSourceUsersDB = new SqlDataSource();

SQLDataSourceUsersDB.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();

SQLDataSourceUsersDB.SelectCommandType = SqlDataSourceCommandType.Text;

SQLDataSourceUsersDB.SelectCommand = "SELECT * FROM Users WHERE Email = @Email";

SQLDataSourceUsersDB.SelectParameters.Add("Email", txtEmail.Text.ToString());
construct a DataAdapter(say da) with the connection and query string.......with this Adapter fill a Dataset(say ds)......this dataset will contain all the records...

Expand|Select|Wrap|Line Numbers
  1.  da = new SqlDataAdapter(mySqlQuery, myConnection); 
  2. ds = new DataSet();
  3. da.Fill(ds, Tablename);
  4.  
Oct 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Phil Powell | last post by:
Here is the scope of what I need to do; want: enrollment_year allowed (even if null) all of ica criteria:
21
by: John Fabiani | last post by:
Hi, I'm a newbie and I'm attempting to learn howto create a select statement. When I use >>> string1='18 Tadlock Place' >>> cursor.execute("SELECT * FROM mytest where address = %s",string1) All...
4
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
2
by: Pavel Stehule | last post by:
Hello, Pg make query 1. and 2. very fast (use index), but for query 3. dont use index. I can solve its using select union, but I readed so pg 7.5 don't problem with OR operator. I use cvs pg. I...
2
by: marco | last post by:
Dear List, as it seems, MS SQL as used in Access does not allow a select INTO within a UNION query. Also, it seems that a UNION query can not be used as a subquery. Maybe my (simplified)...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
0
by: djflow | last post by:
Hi! II was wondering if you can help me with SQL query.. Below 7 separated select query works fine(only when they are retrieved separately) But I want to combined them together and so that i...
22
by: Rickster66 | last post by:
As Instructed this is a new thread regarding my original post: "Select Only 10 Columns Going Back" I'm sorry for the late response. I've been gathering up information and carefully with as much...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.