Lost universe of Programing

USERNAME :- Guest Forum Post:-114
 
HomePortalGalleryRegisterLog in

Share | 
 

 Data Base Connectivity With SQL Server 2000 using C#

Go down 
AuthorMessage
Administrator
Admin
Admin
avatar

Male
Number of posts : 160
Age : 32
Location : Lucknow
Job/hobbies : Software Engeener
What U like To do ? : Because Its Rock with me.
Registration date : 2008-01-06

PostSubject: 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

_________________

""-(`v)-"HACKER OF HEART"-(`v)-"

Back to top Go down
View user profile http://aspx.forumotion.com
 
Data Base Connectivity With SQL Server 2000 using C#
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Lost universe of Programing :: --=| SOURCE CODE |=-- :: CODE FOR C# & ASP.NET-
Jump to: