Administrator Admin
Number of posts : 160 Age : 38 Location : Lucknow Job/hobbies : Software Engeener What U like To do ? : Because Its Rock with me. Registration date : 2008-01-06
| Subject: Data Base Connectivity With SQL Server 2000 using C# 3/1/2008, 7:09 pm | |
| To Connect the Data base from the Sql server 2000, Using C# code, Changing the Password is as follows - Quote :
SqlConnection Connection = new SqlConnection("Server = (local);Initial catalog = Intranet Application;Integrated security = sspi"); Connection.Open(); SqlCommand Command = new SqlCommand("sp_PasswordChange", Connection); Command.CommandType = CommandType.StoredProcedure; Command.Parameters.Add(new SqlParameter("@EmployCode", Txt_EmployCode.Text )); Command.Parameters.Add(new SqlParameter("@OldPassword", Txt_OldPassword.Text )); Command.Parameters.Add(new SqlParameter("@NewPassword", Txt_NewPassword.Text )); DataSet Ds = new DataSet(); SqlDataAdapter Da = new SqlDataAdapter(Command); Da.Fill(Ds); To connect the .Net form through the Stored Procedure where Sp_PasswordChanger is the stored Procedure function or methord name. - Quote :
- CREATE PROCEDURE [DBO].[sp_PasswordChange]
@EmployCode as Varchar(10), @OldPassword as Varchar(16), @NewPassword as Varchar(16) AS Declare @Employ_Code as varchar(10), @output as integer Select @Employ_Code = Employ_Code from Employ_Account where Employ_Code = @EmployCode and Password = @OldPassword if(@Employ_Code = @EmployCode) begin Update Employ_Account set Password = @NewPassword Where Employ_Code = @EmployCode Select @output= 1 End Else begin Select @output = 0 End select @output GO
This is the Code for Stored Procedure For Changing the Password | |
|