Click here to Skip to main content
15,899,124 members
Home / Discussions / C#
   

C#

 
GeneralRe: Rouge Text String in Socket Programing Pin
Nagy Vilmos29-Jul-09 6:48
professionalNagy Vilmos29-Jul-09 6:48 
GeneralRe: Rouge Text String in Socket Programing Pin
User 621557929-Jul-09 6:55
User 621557929-Jul-09 6:55 
GeneralRe: Rouge Text String in Socket Programing Pin
Nagy Vilmos29-Jul-09 7:03
professionalNagy Vilmos29-Jul-09 7:03 
GeneralRe: Rouge Text String in Socket Programing Pin
User 621557929-Jul-09 7:11
User 621557929-Jul-09 7:11 
GeneralRe: Rouge Text String in Socket Programing Pin
Nagy Vilmos29-Jul-09 22:19
professionalNagy Vilmos29-Jul-09 22:19 
GeneralRe: Rouge Text String in Socket Programing Pin
User 621557930-Jul-09 1:54
User 621557930-Jul-09 1:54 
GeneralLogin form connectivity with SQL server 2005 with ADO.NET Pin
Harpreet Singh Matharoo29-Jul-09 4:03
Harpreet Singh Matharoo29-Jul-09 4:03 
GeneralRe: Login form connectivity with SQL server 2005 with ADO.NET Pin
Vimalsoft(Pty) Ltd29-Jul-09 4:50
professionalVimalsoft(Pty) Ltd29-Jul-09 4:50 
First of all you are doing this the Wrong way

First Create a Stored Procedure that does this
Create Procedure prclogin_check
(
@User_name varchar(20),
@U_Password varchar(23),
@Results int Output
)
IF EXISTS (Select * from User_Table
where User_name =@User_name and U_Password = @U_Password)
Set @Results =1



And after you are done with this , you have to do the Following in your C# Code

using System.Data.SqlClient;

String strcon = "User id = sa;Password= topman;Server=myServer;Database=MyDB";
            SqlConnection con = new SqlConnection(strcon);
            SqlCommand cmdselect = new SqlCommand();
            cmdselect.CommandTimeout = 0;
            cmdselect.CommandType = CommandType.StoredProcedure;
            cmdselect.Connection = con;
            cmdselect.CommandText = "prclogin_check";
            cmdselect.Parameters.Add("@Results",SqlDbType.Int,4);
            cmdselect.Parameters["@Results"].Direction = ParameterDirection.Output;
            int Res;

            try
            {
                con.Open();

                cmdselect.ExecuteNonQuery();
                Res = (int)cmdselect.Parameters["@Results"].Value;
                con.Close();

            }
            catch (SqlException e)
            {
                MessageBox.Show(e.Message);
            }using System.Data.SqlClient;

String strcon = "User id = sa;Password= topman;Server=myServer;Database=MyDB";
            SqlConnection con = new SqlConnection(strcon);
            SqlCommand cmdselect = new SqlCommand();
            cmdselect.CommandTimeout = 0;
            cmdselect.CommandType = CommandType.StoredProcedure;
            cmdselect.Connection = con;
            cmdselect.CommandText = "prclogin_check";
            cmdselect.Parameters.Add("@Results",SqlDbType.Int,4);
            cmdselect.Parameters["@Results"].Direction = ParameterDirection.Output;
            int Res;

            try
            {
                con.Open();

                cmdselect.ExecuteNonQuery();
                Res = (int)cmdselect.Parameters["@Results"].Value;
                con.Close();

            }
            catch (SqlException e)
            {
                MessageBox.Show(e.Message);
            }


And in your Business logic or in your Form you can create a Function that will test if the Count of Records is greater than 0,if its less than that , then its invalid login

Hope this Helps

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

QuestionDatagridview DateTimePicker Problem. Pin
priyamtheone29-Jul-09 3:31
priyamtheone29-Jul-09 3:31 
QuestionFind Scroll bar moved either left/right? Pin
spalanivel29-Jul-09 3:15
spalanivel29-Jul-09 3:15 
AnswerRe: Find Scroll bar moved either left/right? Pin
Nagy Vilmos29-Jul-09 3:33
professionalNagy Vilmos29-Jul-09 3:33 
AnswerCP Please ignore Pin
leckey29-Jul-09 4:55
leckey29-Jul-09 4:55 
QuestionHow can i see native code? Pin
frommi29-Jul-09 3:10
frommi29-Jul-09 3:10 
AnswerRe: How can i see native code? Pin
MumbleB29-Jul-09 3:45
MumbleB29-Jul-09 3:45 
GeneralRe: How can i see native code? Pin
PIEBALDconsult29-Jul-09 7:03
mvePIEBALDconsult29-Jul-09 7:03 
AnswerRe: How can i see native code? Pin
Eddy Vluggen29-Jul-09 3:57
professionalEddy Vluggen29-Jul-09 3:57 
AnswerRe: How can i see native code? Pin
frommi29-Jul-09 4:08
frommi29-Jul-09 4:08 
QuestionRe: How can i see native code? Pin
Eddy Vluggen29-Jul-09 4:34
professionalEddy Vluggen29-Jul-09 4:34 
AnswerRe: How can i see native code? Pin
frommi29-Jul-09 4:51
frommi29-Jul-09 4:51 
GeneralRe: How can i see native code? Pin
Eddy Vluggen29-Jul-09 6:05
professionalEddy Vluggen29-Jul-09 6:05 
Questionimage manipulation Pin
strife1929-Jul-09 2:46
strife1929-Jul-09 2:46 
AnswerRe: image manipulation Pin
musefan29-Jul-09 2:58
musefan29-Jul-09 2:58 
GeneralRe: image manipulation Pin
strife1929-Jul-09 3:26
strife1929-Jul-09 3:26 
QuestionCapturing screenshots from games Pin
SimpleData29-Jul-09 1:55
SimpleData29-Jul-09 1:55 
AnswerRe: Capturing screenshots from games Pin
leckey29-Jul-09 4:59
leckey29-Jul-09 4:59 

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.