|
I presume that since you are asking on the SQL forum you are looking for database code. However, currently it would look like you are storing the passwords in clear text - That would be a bit of a security issue.
SELECT COUNT(*) FROM login WHERE username=@UserName AND password=@Password
This will result in a zero if the user name and password combination does not exist. And a 1 if it does exist. Any other value indicates the data is corrupted.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
rahulesquire wrote: pls help me in getting the code
How to help you with the entire code for your long story. First you pass the values to a stored procedure which checks the login details. That could be something like this.
CREATE PROCEDURE LoginCheck
(
@LoginName varchar(50), @Password varchar(50),
@IsAuthenticated varchar(4) OUTPUT
)
AS
IF ( SELECT COUNT(*) FROM YourLoginTable WHERE LoginName = @LoginName And
Password = @Password ) = 0
BEGIN
SET @IsAuthenticated = 'no'
END
Else
BEGIN
SET @IsAuthenticated = 'yes'
END
Now check the output variable value in the page.
|
|
|
|
|
You know, it would be easier to just return the value in a SELECT statement and use ExecuteScalar() - especially given the level of ability of the OP.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
Thanks, That was a new information for me.
Colin Angus Mackay wrote: especially given the level of ability of the OP.
I am not clear with this, could you please make it clear ?
|
|
|
|
|
Navaneeth. wrote: I am not clear with this, could you please make it clear ?
Given the question that the OP (Original Poster) is asking it is clear that he is a beginner. That way, the answer should be accurate but reduce complexity. Passing data as output parameters in a stored procedure is quite a complex thing to do because of the amount of set up than needs to be done to achieve it.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
I am doing the final touch up of a sample application using ASp .net and sql server 2000..
When i am using the query , i am having a problem in getting the values when calling getdate()
it returns null value....
but actually when i hard core the data it shows the values ....
the sample code of stored proc is as follows...
Error comes here..
select @theId= HqState from HQ as THESTATEID where FromDate=getdate()
plz reply me ......
waiting for ur reply.....
-- modified at 1:59 Friday 15th June, 2007
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
|
|
|
|
|
sajan ss wrote: where FromDate=getdate()
Are you storing the dates accurate to the millisecond? If not then an equals operator on GETDATE() won't work.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
i have column in my table for save password
PassWord Char(15) Not Null
and i need to hide data into this column
how i can do that?
123
|
|
|
|
|
Excuse me, but what are you smoking?
How on earth does a style sheet affect whether you can see a column is a database table or not??? He didn't say anything about showing the column in a web page!
|
|
|
|
|
The best way to keep the column from prying eyes is to encrypt the password before you store it in the database. Read this[^] article here on CP for a good explanation on the do's and dont's of storing passwords.
|
|
|
|
|
Dave Kreskowiak wrote: Read this[^] article here on CP for a good explanation on the do's and dont's of storing passwords.
Very good article, Thanks
|
|
|
|
|
Hi,
I work on a project which convert a database access in mysql and I have a field
which has 9 Mb and when I try to convert this field in mysql I get the error:
Error:Unable to write to stream<br />
I put the mysql sintax:
set global max_allowed_packet=16777216
but it doesn't work.
Maybe I didn't put it right.
I put this command in my program.
Please help.
Thanks
-- modified at 9:18 Thursday 14th June,
|
|
|
|
|
You use a third table between the 2 tables you wish to have a many to many relationship between
Table1
-ID
Table2
-ID
Table1ToTable2
-Table1ID
-Table2ID
|
|
|
|
|
the 3rd table having the 2 columns will be composite primary key or foreign key or both.
Thanx
|
|
|
|
|
Both will be foreign keys
|
|
|
|
|
thanx for clearing my confusion
|
|
|
|
|
|
Hi,
I have gone through the third table having two columns will be foreign key columns and composite primary key....
its a correction
Sangram
|
|
|
|
|
Hi
i am using data base Access 2000.
my code implemnting nestsed transactions where using more then one connection
i get the following exception: "oledbexception:could not update currently locked".
i cant put the whole code but i can demonstrate:
if (!Modified) return;
Modified=false;
OleDbTransaction transaction =null;
try
{
OleDbCommand command = new OleDbCommand();
command.Connection=conn;
transaction=conn.BeginTransaction();
command.Transaction=transaction;
command.CommandType = System.Data.CommandType.Text;
command.CommandText = "Delete * from tab";
command.ExecuteNonQuery();
try
{
OleDbConnection secondCon=GetAnotherConnection();
MyClasss.SaveTo(secondCon,Number)
}
catch(Exception ex)
{
throw new Exception("Can't save " + ex.ToString());
}
MyClasss
{
public void SaveTo(OleDbConnection conn,int Number)
{
OleDbTransaction transaction =null;
try
{
OleDbCommand command = new OleDbCommand();
command.Connection=conn;
transaction=conn.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted);
command.Transaction=transaction;
command.CommandType = System.Data.CommandType.Text;
command.CommandText = "Update [Field Records] " +
" SET " +
"[ Cost Periodic]='" + (periodic?"True":"False") + "';";
command.ExecuteNonQuery();
transaction.Commit();
}
catch(Exception ex)
{
if(transaction!=null)
{
transaction.Rollback();
}
throw new Exception("Can't save" + ex.ToString());
}
}
}
Please give your advice.
Thanks in advance.
|
|
|
|
|
Can anyone help me to save a file in SQL Server 2005.
My application will be used by the user to attach the approval mails (Either html or word or any files).
How can i save and retrive from SQL Server 2005?
Anticipating for your replies...
Regards,
Saranya Balasubramanian
|
|
|
|
|
Use a varbinary(max) column type. Use that type in parameters when you add data to the database. When you select it the result will by a byte array in your .NET application.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
|
I am doing an application in which i have to retrieve data from multiple tables...
the scenario is like this...
a head_quarter table have state field...as numeric
and a state table hav the same fields....as varchar...
i wanna retrieve the data from head quarter table using stored procedures and the numeric id should be returned to a string...
considering the string then i hav to get the name of the state from state table and put it into the web page...
my stored proc is
--Author: SAJAN A PILLAI
--Created: 9:14 AM 6/14/2007 THURSDAY
CREATE PROCEDURE sp_GetCurrentHQ
(@cid numeric , @organization varchar(100), @hqaddr1 varchar(100), @hqaddr2 varchar(100), @hqcity varchar(50), @hqstate numeric, @hqpin varchar(7), @hqdistrict numeric,@hqplace numeric, @hqphone varchar(100), @hqfax varchar(100), @hqemail varchar(100), @hqwebsite varchar(100), @hqpan varchar(50), @hqtan varchar(50), @hqtin varchar(50),
@hqstatetaxno varchar(50), @hqcentraltaxno varchar(50), @hqfromdate datetime, @todate datetime)
AS
BEGIN
declare @state_name as varchar(128);
select @state_name = SHORT_FORM from states where ADM1 = '2';
set @st_name=@state_name;
select OrgName,HqAdd1, HqCity,HqState,HqPin,HqPlace, HqDist, HqPhones ,HqFax,HqEmail,HqWebsite,HqPAN,HqTIN,HqStateTax,HqCentralTax,FromDate,ToDate from HQ where FromDate <= getdate() and ToDate >= getdate();
END
GO
please help me
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
|
|
|
|
|
i have just started learninf SQL 2000
when i mamakin simplest query in query analyzer select * from authors, where authors is the name of table,
its giving error that invalid object ' authors'.
how this error can be resolved???
|
|
|
|
|
1. check the authors tabls exists in the database
2. check whether you selected / pointed the right database
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|