Click here to Skip to main content
15,892,809 members
Home / Discussions / C#
   

C#

 
GeneralBasic EventHandling Question Pin
SandeepN23-Sep-04 6:42
SandeepN23-Sep-04 6:42 
GeneralInterfacing with C Vendor DLLs Pin
Evelyne23-Sep-04 4:53
Evelyne23-Sep-04 4:53 
GeneralRe: Interfacing with C Vendor DLLs Pin
Heath Stewart23-Sep-04 6:58
protectorHeath Stewart23-Sep-04 6:58 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne23-Sep-04 8:47
Evelyne23-Sep-04 8:47 
GeneralRe: Interfacing with C Vendor DLLs Pin
Heath Stewart23-Sep-04 10:17
protectorHeath Stewart23-Sep-04 10:17 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne24-Sep-04 16:15
Evelyne24-Sep-04 16:15 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne28-Sep-04 10:32
Evelyne28-Sep-04 10:32 
QuestionC# SQL data check like in PHP??? Pin
cemlouis23-Sep-04 4:44
cemlouis23-Sep-04 4:44 
Hi,

I have a problem, I want to check a data is entered to SQL database or not. I am making this in PHP like below:

<br />
$sql_name_check = mysql_query("SELECT name FROM names WHERE name='$buffer_name'");<br />
if(!mysql_num_rows($sql_name_check)){<br />
	//Do this do that...<br />
}<br />


So I want to do that in C# so I made a code block which is below:

<br />
int k=0;<br />
string buffer_name = "Cem Louis";<br />
SqlConnection mySqlConnection = new SqlConnection("Initial Catalog=names;Data Source=localhost;Integrated Security=SSPI;");<br />
SqlCommand mySqlCommand = mySqlConnection.CreateCommand();<br />
mySqlCommand.CommandText = "SELECT name, tel FROM names WHERE tel = '1' AND name = name";<br />
mySqlConnection.Open();<br />
SqlDataReader mySqlDataReader3 = mySqlCommand.ExecuteReader();<br />
while(mySqlDataReader3.Read())<br />
{<br />
	k++;<br />
}<br />
if(k > 0)<br />
	//Do this do that...<br />
	return false;<br />
else<br />
	return true;<br />
mySqlDataReader3.Close();<br />
mySqlConnection.Close();<br />


Thank you;
Cem Louis...
AnswerRe: C# SQL data check like in PHP??? Pin
Werdna23-Sep-04 10:32
Werdna23-Sep-04 10:32 
GeneralRe: C# SQL data check like in PHP??? Pin
cemlouis23-Sep-04 11:12
cemlouis23-Sep-04 11:12 
GeneralRe: C# SQL data check like in PHP??? Pin
Werdna23-Sep-04 11:38
Werdna23-Sep-04 11:38 
GeneralRe: C# SQL data check like in PHP??? Pin
cemlouis23-Sep-04 12:20
cemlouis23-Sep-04 12:20 
Generalreading a file Pin
cmarmr23-Sep-04 3:42
cmarmr23-Sep-04 3:42 
GeneralRe: reading a file Pin
Heath Stewart23-Sep-04 6:21
protectorHeath Stewart23-Sep-04 6:21 
GeneralRe: reading a file Pin
cmarmr23-Sep-04 8:12
cmarmr23-Sep-04 8:12 
GeneralRe: reading a file Pin
StealthyMark24-Sep-04 1:16
StealthyMark24-Sep-04 1:16 
Generalwhich events ocur Pin
karanba23-Sep-04 3:39
karanba23-Sep-04 3:39 
GeneralRe: which events ocur Pin
Heath Stewart23-Sep-04 7:52
protectorHeath Stewart23-Sep-04 7:52 
GeneralUsing Web service as business logic layer Pin
shambho23-Sep-04 2:59
shambho23-Sep-04 2:59 
GeneralRe: Using Web service as business logic layer Pin
Salil Khedkar23-Sep-04 3:48
Salil Khedkar23-Sep-04 3:48 
GeneralRe: Using Web service as business logic layer Pin
shambho23-Sep-04 4:59
shambho23-Sep-04 4:59 
GeneralRe: Using Web service as business logic layer Pin
Heath Stewart23-Sep-04 7:39
protectorHeath Stewart23-Sep-04 7:39 
GeneralFind controls without knowing the name Pin
coddyuk23-Sep-04 2:49
coddyuk23-Sep-04 2:49 
GeneralRe: Find controls without knowing the name Pin
sreejith ss nair23-Sep-04 3:20
sreejith ss nair23-Sep-04 3:20 
GeneralRe: Find controls without knowing the name Pin
shambho23-Sep-04 3:40
shambho23-Sep-04 3:40 

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.