Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
QuestionXP Themes Pin
Russell Jones4-Jan-07 22:17
Russell Jones4-Jan-07 22:17 
AnswerRe: XP Themes Pin
Dominik Reichl4-Jan-07 22:42
Dominik Reichl4-Jan-07 22:42 
GeneralRe: XP Themes Pin
Russell Jones4-Jan-07 22:46
Russell Jones4-Jan-07 22:46 
Questionusing a namespace Pin
Member 20251764-Jan-07 21:40
Member 20251764-Jan-07 21:40 
AnswerRe: using a namespace Pin
Russell Jones4-Jan-07 21:48
Russell Jones4-Jan-07 21:48 
QuestionData validation in c# and SQL server 2000 Pin
phokojoe4-Jan-07 21:31
phokojoe4-Jan-07 21:31 
AnswerRe: Data validation in c# and SQL server 2000 Pin
Russell Jones4-Jan-07 22:13
Russell Jones4-Jan-07 22:13 
GeneralRe: Data validation in c# and SQL server 2000 Pin
phokojoe4-Jan-07 23:08
phokojoe4-Jan-07 23:08 
Yep!

Thanks a lot. It worked but to a certain level. I maneged to retrive just 1 record/column before I intoroduce the if statement. I have about 127 records at present, but when I introcude the if statement to compare the values and then display them in the richtextbox, I get the message on the if statement

"An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: Input string was not in a correct format."

this is the code
try
{
string str = "select * FROM table1";

con = new SqlConnection(_connect);

cmd = new SqlCommand();

cmd.Connection = con;

cmd.CommandType = CommandType.Text;

cmd.CommandText = str;

// Open the Connection

con.Open();

dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

while (dr.Read())
{
if (System.Convert.ToInt32(dr[10]) < 20)
{
rtb.Text = dr[7].ToString();
}
}

}
catch(SqlException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
// Close the Connection object
con.Close();
}
I am comparing column 10 with the age of the person that is 20 and then display the id of that particular record in textbox which is in column 7.

Can you please point where I am doing the wrong thing
Cheers!Unsure | :~

phokojoe

GeneralRe: Data validation in c# and SQL server 2000 Pin
Russell Jones5-Jan-07 0:31
Russell Jones5-Jan-07 0:31 
GeneralRe: Data validation in c# and SQL server 2000 Pin
phokojoe5-Jan-07 1:33
phokojoe5-Jan-07 1:33 
QuestionLimitation of FSWatcher & Windows Service Pin
Fayyaz Lodhi4-Jan-07 21:23
Fayyaz Lodhi4-Jan-07 21:23 
Questionxml reading/editing/writing Pin
divakarjmc104-Jan-07 19:37
divakarjmc104-Jan-07 19:37 
AnswerRe: xml reading/editing/writing Pin
sajid.salim.khan4-Jan-07 20:11
sajid.salim.khan4-Jan-07 20:11 
AnswerRe: xml reading/editing/writing Pin
Mircea Puiu4-Jan-07 20:43
Mircea Puiu4-Jan-07 20:43 
QuestionHow to Make EXE Pin
sajid.salim.khan4-Jan-07 19:07
sajid.salim.khan4-Jan-07 19:07 
GeneralRe: How to Make EXE Pin
Tyler454-Jan-07 19:31
Tyler454-Jan-07 19:31 
GeneralBut Sir Pin
sajid.salim.khan4-Jan-07 20:17
sajid.salim.khan4-Jan-07 20:17 
AnswerRe: But Sir Pin
Tyler454-Jan-07 20:28
Tyler454-Jan-07 20:28 
GeneralRe: But Sir Pin
sajid.salim.khan4-Jan-07 20:38
sajid.salim.khan4-Jan-07 20:38 
AnswerRe: But Sir Pin
Tyler454-Jan-07 20:58
Tyler454-Jan-07 20:58 
GeneralRe: But Sir Pin
JacquesDP4-Jan-07 20:34
JacquesDP4-Jan-07 20:34 
AnswerRe: How to Make EXE Pin
Mircea Puiu4-Jan-07 21:05
Mircea Puiu4-Jan-07 21:05 
AnswerRe: How to Make EXE Pin
Christian Graus4-Jan-07 23:58
protectorChristian Graus4-Jan-07 23:58 
AnswerRe: How to Make EXE Pin
TrooperIronMan5-Jan-07 5:34
TrooperIronMan5-Jan-07 5:34 
AnswerRe: How to Make EXE Pin
Tyler455-Jan-07 12:14
Tyler455-Jan-07 12:14 

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.