Click here to Skip to main content
16,006,845 members
Home / Discussions / C#
   

C#

 
GeneralRe: Log off/Lock a client machine Pin
eggie56-Jul-05 10:54
eggie56-Jul-05 10:54 
GeneralRe: Log off/Lock a client machine Pin
eternalsoul6-Jul-05 20:01
eternalsoul6-Jul-05 20:01 
GeneralFeedback from a form Pin
Carl-Johan Larsson6-Jul-05 9:55
Carl-Johan Larsson6-Jul-05 9:55 
GeneralRe: Feedback from a form Pin
Christian Graus6-Jul-05 11:29
protectorChristian Graus6-Jul-05 11:29 
GeneralRe: Feedback from a form Pin
Carl-Johan Larsson6-Jul-05 18:48
Carl-Johan Larsson6-Jul-05 18:48 
GeneralPowerCollections 1.0 is released Pin
Kevin McFarlane6-Jul-05 9:53
Kevin McFarlane6-Jul-05 9:53 
GeneralRe: PowerCollections 1.0 is released Pin
Judah Gabriel Himango6-Jul-05 10:57
sponsorJudah Gabriel Himango6-Jul-05 10:57 
GeneralFind user & password in Access DB. Pin
sea#6-Jul-05 9:30
sea#6-Jul-05 9:30 
I'm writing a small app, and I have to prepare a form which will authenticate users. This is the code I wrote. The problem is I get exception in the marked line : "no value given for for on or more required parameters"
What is wrong with it?
Table name is users.
Column name is UserName
<br />
public void userExists(string username)<br />
		{<br />
		try<br />
			{//SQL statements<br />
			string sqlFinduser = "SELECT COUNT(UserName) AS UserNameExists " +<br />
					"FROM users " +<br />
					"WHERE (UserName=" + username + ")";<br />
<br />
				//Command object<br />
				OleDbCommand cmdFindsqlFinduser = new OleDbCommand();<br />
			<br />
				cmdFindsqlFinduser.Connection = cnSurvey;<br />
				cmdFindsqlFinduser.CommandType = CommandType.Text;<br />
				cmdFindsqlFinduser.CommandText = sqlFinduser;<br />
<br />
				//Connect<br />
				cnSurvey.Open();<br />
<br />
				//Execute command<br />
int count = int.Parse(cmdFindsqlFinduser.ExecuteScalar().ToString()); <br />
			//error is right here                      <br />
<br />
				bool exists = count != 0 ? true : false;<br />
			<br />
			//Disconnect<br />
			cnSurvey.Close();<br />
<br />
			//Return result<br />
	//		return exists;<br />
				}<br />
			catch(Exception ex)<br />
			{<br />
				MessageBox.Show(ex.Message);<br />
			}<br />
		<br />
		}<br />
<br />


TIA,

Ronen
GeneralRe: Find user & password in Access DB. Pin
Guffa6-Jul-05 11:17
Guffa6-Jul-05 11:17 
GeneralRe: Find user &amp; password in Access DB. Pin
malharone6-Jul-05 13:13
malharone6-Jul-05 13:13 
GeneralRe: Find user &amp; password in Access DB. Pin
Matt Gerrans7-Jul-05 10:57
Matt Gerrans7-Jul-05 10:57 
GeneralPlease help - COM Interop Pin
metal_rob6-Jul-05 8:44
metal_rob6-Jul-05 8:44 
GeneralRe: Please help - COM Interop Pin
mav.northwind6-Jul-05 22:43
mav.northwind6-Jul-05 22:43 
GeneralRe: Please help - COM Interop Pin
metal_rob7-Jul-05 2:15
metal_rob7-Jul-05 2:15 
GeneralRe: Please help - COM Interop Pin
mav.northwind7-Jul-05 11:06
mav.northwind7-Jul-05 11:06 
Generalclosing the form with the [x] button Pin
marazm16-Jul-05 8:25
marazm16-Jul-05 8:25 
GeneralRe: closing the form with the [x] button Pin
LongRange.Shooter6-Jul-05 9:26
LongRange.Shooter6-Jul-05 9:26 
GeneralDatabase question Pin
Tom Wright6-Jul-05 8:20
Tom Wright6-Jul-05 8:20 
GeneralRe: Database question Pin
Anonymous6-Jul-05 8:29
Anonymous6-Jul-05 8:29 
GeneralRe: Database question Pin
Tom Wright6-Jul-05 8:46
Tom Wright6-Jul-05 8:46 
GeneralRe: Database question Pin
Luis Alonso Ramos6-Jul-05 8:54
Luis Alonso Ramos6-Jul-05 8:54 
GeneralRe: Database question Pin
Guffa6-Jul-05 9:01
Guffa6-Jul-05 9:01 
GeneralRe: Database question Pin
Tom Wright7-Jul-05 11:09
Tom Wright7-Jul-05 11:09 
GeneralRe: Database question Pin
Guffa7-Jul-05 12:29
Guffa7-Jul-05 12:29 
GeneralDelete Button in Datagrid Pin
just4ulove76-Jul-05 7:29
just4ulove76-Jul-05 7:29 

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.