|
not like that........
wat i mean to say is.......
i have alogin page where user enters his/her username and password
i have to check the data with database and redirect the user to corresponding next page for the i need a query.
|
|
|
|
|
bhattiprolu wrote: i have to check the data with database and redirect the user to corresponding next page for the i need a query
I cant see what the problem is, because after the select statement you will have all data specific to that user, so redirecting the user to the correct page should be a breeze. Just pass the information of the user to the next page. Unless I'm totlally mis-understanding you.
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
can u gimme the query.....
|
|
|
|
|
HE DID!!
He gave you this:
SELECT * FROM <TABLENAME> WHERE USER = 'JOHN' AND PASS = 'MYPASS'
But since you've told us nothing about your database structure it may not be correct.
If you want more help you'll have to help us understand your problem. Repeating the same statements over and over again do not help. You need to give us more information.
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
bhattiprolu wrote: not like that........
Your original post said:
i have username and password fields in my table,
i jus want to write a query to check whether the given details of user matches with the database.
please gimme the query
What other answer could you expect from that?!
bhattiprolu wrote: i have to check the data with database and redirect the user to corresponding next page for the i need a query.
You mentioned nothing about login pages or redirecting users. How were we supposed to know, especially since you posted this in the "SQL" forum?
If you've got the data and youre question is about ASP.NET post in the appropriate forum.
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
SELECT * FROM <tablename> WHERE USER = 'JOHN' AND PASS = 'MYPASS'
this is the write query...
now if u r using c# or vb.net
get result of this query in datareader and dataadaptor..
if any row returns that means username and password is correct... then redirect to the other page..
|
|
|
|
|
They Already gave u the right Query..if u're try to implement that query in your
apps just change the where value, ex :
<br />
Select * From [my_table] WHERE username = '" +UserText.Text+ "' AND password = '" +PasswdText.Text+ "'<br />
wat else do u need they gave u the right query u need
Regards,
Tomi
|
|
|
|
|
TomiEdy wrote: Select * From [my_table] WHERE username = '" +UserText.Text+ "' AND password = '" +PasswdText.Text+ "'
Then get ready for a SQL Injection Attack with code like that!
Please read: SQL Injection Attacks and Tips on How to Prevent Them[^]
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live.
Upcoming FREE developer events:
* Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ...
* Reading: SQL Bits
My website
|
|
|
|
|
Hi all,
I would like to know whether one uses the to_date function in a update statement aswell, as one would in a insert statement (when making use of a Oracle Database).
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
I make use of the 'to_date' function everywhere. Whether it's a 'select', 'insert', 'update' or even a 'delete' statement, you can use a function call just about anywhere.
Do you have a specific instance that is giving you an error or problem?
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
Hello guys..
Looks like I just need a litle help on my SQL syntax in C#.NET
I have a field in my database which is DateTime type. Looks like I can't get the syntax right for comparing the value from the textBox with the field in database.
Now what I have looks like:
<br />
DateTime ShDate = DateTime.Parse(txtDate.Text);<br />
cmd1.CommandText = "SELECT ShipedDate FROM Details WHERE Details.ShipedDate = #ShDate#";<br />
When I fill dataset with the adapter which has this SelectCommand it will report error in date in the syntax expresion. Now the variable ShDate has a DateTime type in C# and it stores a date from the textbox with a help of conversion and it is in a correct format(I cheked while debuging).
I think the problem is somewhere here = #ShDate# . I bet I am missing some quotation marks ("") or single quote('').
So does any one have a clue?
Thanks..
|
|
|
|
|
Hi,
I think you are just now migrating from MS-Acccess.
When comparing date in SQL Server no need of "#".
Just simply " = ShDate " is enough.
Senthil
|
|
|
|
|
Can you try this out...
DateTime ShDate = DateTime.Parse(txtDate.Text);
cmd1.CommandText = 'SELECT ShipedDate FROM Details WHERE Details.ShipedDate =%' + ShDate + '%';
See if it helps.
Thanks!
Santhosh
Santhosh Kumar Edukulla
|
|
|
|
|
Apologies, ignore my previous post..
Try this
DateTime ShDate = DateTime.Parse(txtDate.Text);
cmd1.CommandText = 'SELECT ShipedDate FROM Details WHERE Details.ShipedDate like' + '''' + '%' + ShDate + '%' + '''';
I tried it on my sql box and it worked.
Hope this helps
Thanks!
Santhosh Kumar Edukulla
|
|
|
|
|
I'm looking to develop an application that will require a small database table structure (not more then 4-5 tables). I wanted to make the database internal to the application so that there wouldn't have to be a link out to a web server/SQL server anywhere, but with just receiving a new datafile to replace the old one, it would be able to pick it up. Is there any code/project type in Visual Studio that would allow me to create such a database that could be deployed with the application and be able to be queried with a SQL/Oracle type interface/query? I am open to writing the application in either Visual Basic or Visual C++.
|
|
|
|
|
|
I will look into it, but from a quick glance, it may just be that. Thank you very much.
|
|
|
|
|
Hi All
I Finished Deployment windows application and i will to setup it in the customer
My database is SqlSERVER 2005
I Used SqlServer EXPRESS 2005 to set the Backup of data base on it in the pc of customer
the Server is Mixed MOde
when I Running my Application The is give me this the Exeption
(An Erorr occurred while establishing aconnection to SQL Server 2005 , this failure may be caused by the fact that under the defult Settings SQL Server does not allow remote Connection (Provider :SQL Network Interface error :26-Error locating Server/Interface Specified))
what is the solve for this Problem ??
thanks for all Hellp me
Thaer
|
|
|
|
|
Hi Thaer Hamael
1- Go To Start -->Programs --> Microsoft SQL Server 2005 --> Configuration Tools
--> SQL Server 2005 Surface Area Configuration
2- collapse Analysis Service
3- Choice Local and remote Connection
4-Choice Database Engine and choice Remote connection Local and remote Connection and using both
Rami Abd Alhalim
|
|
|
|
|
i have to delete data but i have problem found relation between tables so i cant
delete data
how can delete data without drop relation ship between tables???
Rami Abd Alhalim
|
|
|
|
|
If I am understanding you correctly, you can not do this. That is the purpose of the foreign key constaint. It will not allow you to delete the data without dropping the relationship between the tables. The only other options is to delete data from all the tables in the correct sequence.
Hope that helps.
Ben
|
|
|
|
|
Thanks
how correct sequence
|
|
|
|
|
It depends on how your tables are related. Let's say you had:
ParentTable1
ChildTable1
ChildTable2
Both ChildTable1 and ChildTable2 have parenttable1ID which is the key. All of the records in childTable1 and childTable2 that have that parenttable1ID must be deleted before the record in ParentTable1 with parenttable1id can be deleted.
The benifit of this is that you can't orphen the Child table records. They must be deleted before the parent table record can be deleted.
Hope that helps.
Ben
|
|
|
|
|
set particular column's constraint as
Delete Rule as Set null
and
Update Rule as Set null
You can find this option where you define the relationship of tables. it is titled with "Insert and Update Specification" of sql server management studio.
divyesh
|
|
|
|
|
I need some help writing a stored proc. First, I am inserting a range of ZipCodes into a db, ZipBegin and ZipEnd(12345-12346). Although that seems relatively simple, however, I need to check those ranges and make sure that there is no other over lapping range.
for more clarity:
range A 12345-12346 is in the db
range B 12344-12347 is being inserted.
as you can see these ranges overlap, if that occurs I need to use a raiserror and rollback the transaction.
Does anyone have any suggestions on how I could do that?
|
|
|
|