Click here to Skip to main content
15,881,599 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL Server 2008 in C# Console Appications Pin
Henry Minute30-May-09 8:59
Henry Minute30-May-09 8:59 
GeneralRe: SQL Server 2008 in C# Console Appications Pin
bigjoe11a30-May-09 9:08
bigjoe11a30-May-09 9:08 
GeneralRe: SQL Server 2008 in C# Console Appications Pin
Henry Minute30-May-09 9:14
Henry Minute30-May-09 9:14 
GeneralRe: SQL Server 2008 in C# Console Appications Pin
Henry Minute30-May-09 9:22
Henry Minute30-May-09 9:22 
GeneralRe: SQL Server 2008 in C# Console Appications Pin
bigjoe11a30-May-09 9:59
bigjoe11a30-May-09 9:59 
GeneralRe: SQL Server 2008 in C# Console Appications Pin
Henry Minute30-May-09 10:43
Henry Minute30-May-09 10:43 
GeneralRe: SQL Server 2008 in C# Console Appications Pin
bigjoe11a30-May-09 11:31
bigjoe11a30-May-09 11:31 
GeneralRe: SQL Server 2008 in C# Console Appications Pin
Henry Minute30-May-09 11:52
Henry Minute30-May-09 11:52 
For that you will need to use a SELECT Command, which would look something like:
SELECT * FROM dbo.UaersData WHERE Name = @userName


******************************** Note **************************
This is only approximate. and it uses a parameter (the @userName)

However instead of that you can do as you have done for the INSERT and break the string into bits, a bit like:
string commandString = "SELECT * FROM dbo.UaersData WHERE Name = '" + theVariableHoldingTheNameFromTheConsole + "'";


In order to use it efficiently however you really should use the Prameterized methodology.

In the mean time take a look at this[^], scroll down till you reach the Executing SQL Statements that Return Rows Using a Command Object section. This is very similar to the method you have been using. You will then need to research the SqlDataReader object to find out how to get the data from the reader

As this is really basic stuff, I think you will be better off if you do some reading in the MSDN Documentation, and by googling.
If you have any further questions, I would suggest that you start a new thread, as I will be away from my PC for a few hours.

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

GeneralRe: SQL Server 2008 in C# Console Appications Pin
bigjoe11a30-May-09 12:03
bigjoe11a30-May-09 12:03 
QuestionUpdating changings back to DB from DataGridView Pin
WinSolution30-May-09 3:11
WinSolution30-May-09 3:11 
AnswerRe: Updating changings back to DB from DataGridView Pin
Henry Minute30-May-09 4:12
Henry Minute30-May-09 4:12 
AnswerRe: Updating changings back to DB from DataGridView Pin
I Believe In GOD30-May-09 10:08
I Believe In GOD30-May-09 10:08 
GeneralRe: Updating changings back to DB from DataGridView Pin
Henry Minute30-May-09 10:51
Henry Minute30-May-09 10:51 
GeneralRe: Updating changings back to DB from DataGridView Pin
I Believe In GOD30-May-09 12:38
I Believe In GOD30-May-09 12:38 
GeneralRe: Updating changings back to DB from DataGridView Pin
WinSolution31-May-09 1:31
WinSolution31-May-09 1:31 
GeneralRe: Updating changings back to DB from DataGridView Pin
I Believe In GOD31-May-09 1:49
I Believe In GOD31-May-09 1:49 
QuestionGet the absolute pix of Html Element Using mshtml Pin
Member 437807730-May-09 3:00
Member 437807730-May-09 3:00 
QuestionPlease help Pin
Etienne_12330-May-09 1:57
Etienne_12330-May-09 1:57 
AnswerRe: Please help Pin
Henry Minute30-May-09 4:02
Henry Minute30-May-09 4:02 
AnswerRe: Please help Pin
I Believe In GOD30-May-09 10:11
I Believe In GOD30-May-09 10:11 
GeneralRe: Please help Pin
Etienne_12330-May-09 23:31
Etienne_12330-May-09 23:31 
GeneralRe: Please help Pin
I Believe In GOD31-May-09 1:54
I Believe In GOD31-May-09 1:54 
Questionservice of Events in C# [modified] Pin
arturw8230-May-09 1:40
arturw8230-May-09 1:40 
AnswerRe: service of Events in C# Pin
Moreno Airoldi30-May-09 7:15
Moreno Airoldi30-May-09 7:15 
Questionwrong behaviour of Text Reader Pin
vishal moharikar30-May-09 1:03
vishal moharikar30-May-09 1:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.