1

I have a simple html 5 login page, I need to open a sql connection and have a condition to match the entered details and match or not.

code i have right now is this

Email Address: <input id="Text1" type="text" />

Password: <input id="Password1" type="password" />

<input id="Submit1" type="submit" value="Submit"  onclick="loginFunction()"/> 

<input id="Reset1" type="reset" value="Cancel" />

I have created onclick function. Please help me to open a sql connection and verify the login details

captainsac
  • 2,484
  • 3
  • 27
  • 48
  • 2
    You need server-side scripting for that. – Zee May 27 '15 at 11:02
  • you have to call sql query from any server side code then call that method from jQuery then you can bring the data in jQuery object – wiretext May 27 '15 at 11:04
  • possible duplicate of [How to connect to SQL Server database from JavaScript?](http://stackoverflow.com/questions/857670/how-to-connect-to-sql-server-database-from-javascript) – Andrey Korneyev May 27 '15 at 11:05

2 Answers2

2

You need a server side to retrieve data.

You have a bunch of databases that you can use.

Going for a mysql database would be a nice approach as it is 100% open source, very simple and it offers stability, if you choose it advice you to choose php for server side, it is old and not very power full but is good for simple pages and for beginners.

If you prefer a NoSQL database you can chose mongoDb for example and (although i have no experience with this) I think that you can link to the database with json

Diogo Cunha
  • 1,194
  • 11
  • 23
-1

If you are using sql server ms as databse and c# as the server side coding,which i assume you must be using . In the Page Load Or On the Button Click Event Establish a connection string as below.

string connectionString="Data Source=servername;InitialCatalog=DataBaseName;UserID=sa;  Password=YourPassword;"

Now create an Sql Connection object and open the connection

SqlConnection sqlConnection=new SqlConnection(connectionString);
 sqlConnection.open();

Now the database connection is set.If you want to fire any queries now use Sql Command Class.The Parameters of the sqlcommand object are the querystring and connection object.

string insertStatement="INSERT INTO TableName(column1,column2) VALUES Txtb1+","+Txtb2";

SqlCommand sqlCommand=new SqlCommand(insertStatement,sqlConnection);
bhanu.cs
  • 1,345
  • 1
  • 11
  • 25