Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
GeneralRe: set the input for a text box from addition class. Pin
cue_ball7-Sep-05 15:10
cue_ball7-Sep-05 15:10 
QuestionGet data from Com Port Pin
quocbao6-Sep-05 20:36
quocbao6-Sep-05 20:36 
AnswerRe: Get data from Com Port Pin
Russell Jones6-Sep-05 23:02
Russell Jones6-Sep-05 23:02 
QuestionUpdating data in Form A from form B? Pin
Johan Glysing6-Sep-05 20:17
Johan Glysing6-Sep-05 20:17 
AnswerRe: Updating data in Form A from form B? Pin
Gavin Jeffrey6-Sep-05 22:21
Gavin Jeffrey6-Sep-05 22:21 
GeneralRe: Updating data in Form A from form B? Pin
Johan Glysing6-Sep-05 22:40
Johan Glysing6-Sep-05 22:40 
GeneralRe: Updating data in Form A from form B? Pin
Ashok Dhamija6-Sep-05 23:26
Ashok Dhamija6-Sep-05 23:26 
QuestionDataReader Issue Pin
Expert Coming6-Sep-05 18:42
Expert Coming6-Sep-05 18:42 
I am using a datareader to read cells in a database. Here are a few pieces of my code, what is wrong?

using System;<br />
using System.Data;<br />
using System.Data.OleDb;<br />
<br />
		string szQUser = txtUser.Text;<br />
<br />
		//Our connection string to the DB<br />
string szConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\inetpub\\runescapestats.mdb";<br />
		//Open Connection to the database<br />
		OleDbConnection cn = new OleDbConnection(szConn);<br />
		cn.Open();<br />
  		<br />
                //The query for the database<br />
		StringBuilder szMyQuery = new StringBuilder ();<br />
		szMyQuery.Append ("SELECT User.Username, User.Password FROM [User] WHERE (((User.Username)=\'szQUser\'))");<br />
<br />
                //The building of the reader    <br />
		OleDbCommand cmd = new OleDbCommand(szMyQuery.ToString (), cn);<br />
    <br />
		OleDbDataReader rdr = cmd.ExecuteReader();<br />
  <br />
		while (rdr.Read())<br />
		{<br />
			int iUsernameOrdinal = rdr.GetOrdinal("Username");<br />
			int iPasswordOrdinal = rdr.GetOrdinal("Password");<br />
			string szUsername = rdr.GetString(iUsernameOrdinal);<br />
			string szPassword = rdr.GetString(iPasswordOrdinal);<br />
			<br />
			if(szPassword == txtPass.Text)<br />
			{<br />
			Output.Text = "Logged In";<br />
			}<br />
			else<br />
			{<br />
			Output.Text = "Failed";<br />
			}<br />
	}<br />
	}<br />
<br />
	finally<br />
	{<br />
		//Cleanup<br />
                //THIS IS WHERE THE ERROR OCCURS<br />
		<big>rdr.Close();<br />
		cn.Close();</big><br />
	}


Thanks for any feedback.
AnswerRe: DataReader Issue Pin
Gavin Jeffrey6-Sep-05 22:34
Gavin Jeffrey6-Sep-05 22:34 
AnswerRe: DataReader Issue Pin
Guffa6-Sep-05 23:49
Guffa6-Sep-05 23:49 
QuestionTry... Catch.... help Pin
sonicsqwirl6-Sep-05 18:28
sonicsqwirl6-Sep-05 18:28 
AnswerRe: Try... Catch.... help Pin
Expert Coming6-Sep-05 18:43
Expert Coming6-Sep-05 18:43 
AnswerRe: Try... Catch.... help Pin
Christian Graus6-Sep-05 18:46
protectorChristian Graus6-Sep-05 18:46 
GeneralRe: Try... Catch.... help Pin
Expert Coming6-Sep-05 19:00
Expert Coming6-Sep-05 19:00 
AnswerRe: Try... Catch.... help Pin
S. Senthil Kumar6-Sep-05 19:12
S. Senthil Kumar6-Sep-05 19:12 
Question.net reporting addin Pin
bwagz6-Sep-05 18:08
bwagz6-Sep-05 18:08 
QuestionI can't Create File in the dir that FileSystemWatch monitor by using FileStream Pin
6-Sep-05 17:47
suss6-Sep-05 17:47 
AnswerRe: I can't Create File in the dir that FileSystemWatch monitor by using FileStream Pin
Dave Kreskowiak8-Sep-05 1:40
mveDave Kreskowiak8-Sep-05 1:40 
QuestionChange Parent form from Dialog Box Pin
bootn6-Sep-05 17:11
bootn6-Sep-05 17:11 
AnswerRe: Change Parent form from Dialog Box Pin
Christian Graus6-Sep-05 17:29
protectorChristian Graus6-Sep-05 17:29 
QuestionMemory Management Pin
VickyC#6-Sep-05 15:08
VickyC#6-Sep-05 15:08 
AnswerRe: Memory Management Pin
Matt Gerrans6-Sep-05 15:30
Matt Gerrans6-Sep-05 15:30 
GeneralRe: Memory Management Pin
VickyC#6-Sep-05 16:02
VickyC#6-Sep-05 16:02 
GeneralRe: Memory Management Pin
Dave Kreskowiak6-Sep-05 16:18
mveDave Kreskowiak6-Sep-05 16:18 
GeneralRe: Memory Management Pin
VickyC#6-Sep-05 16:33
VickyC#6-Sep-05 16:33 

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.