Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm writing a project that remotely connects to an sql server. I need some help with some details. Questions like,

Do i allow remote connections to the sql server or pipe the data through the server app?

How should I setup the stored procedures for user signup and authentication.

The client will communicate with the server via TCPIP and I'm not sure how I should handle the communications (ie. how do i split the data being transferred and should I wrap that with some kind of custom proctocol)

cyberm0t0...
Posted

1 solution

Dear cyberm0t0,

I would like to tell that while you are using database in your project you need to write ConnectionString in your code to establish connection. No other settings are required.

Best place to write ConnectionString is Web.config (in Web Project) and App.config (in window project).

You do not need to any information/setting except from following:

<add name="cn" connectionString="server=Server-IP;database=DatabaseName;uid=UserID;pwd=Password" providerName="System.Data.SqlClient"/>


Stored procedure for user signup and authentication:
You need recieve two parameter from user One is UserName and Another is Password. You will check password if User exists. Otherwise Show wrong user message. let me make your work easy:

Create PROCEDURE SPName
(
@unam varchar(50),
@upwd varchar(50),
@regcod int out
)
as
declare @ap varbinary(50)
select @ap= cast(upwd as varbinary(50)) from tbusr where cast(unam as varbinary(50))=cast(@unam as varbinary(50))
if @ap is null
begin
set @regcod=0;
end
else if @ap=cast(@upwd as varbinary(50))
begin
select @regcod= uregcod from tbusr where unam=@unam
end
else
begin
set @regcod=-1;
end


@regcod is an output parameter which return his profile id for further use.
I hope it will help use.

Regards!
Aman
 
Share this answer
 
Comments
Aman4.net 29-Dec-10 1:25am    
Dear cyberm0t0,
Please accept as answer If it is helpful.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900