Sunday, March 25, 2012

a webpage that directly inputs data to a specific table in an sql database ?

im new to sql and ive created a test data base with a test table having 3 input fields i was wondering if it was possible to use a webpage to input data into the database in a specific table
ive seen some net articles discussing this but as i said im new they talked about using an asp page,so i was wondering if someone could help me out with a simple code to enable a webpage to input data on an sql table
so how do i go about it ?
test_database
dbo.test_table
the 3 input fields are name age gender

ive also set an odbc for the data base (test_database) set at native

tnx

Quote:

Originally Posted by arawsg

im new to sql and ive created a test data base with a test table having 3 input fields i was wondering if it was possible to use a webpage to input data into the database in a specific table
ive seen some net articles discussing this but as i said im new they talked about using an asp page,so i was wondering if someone could help me out with a simple code to enable a webpage to input data on an sql table
so how do i go about it ?
test_database
dbo.test_table
the 3 input fields are name age gender

ive also set an odbc for the data base (test_database) set at native

tnx


Hi ,

I don't know which platform you are using to develop your webpage.I give you sample code here to insert data into a sql server database table from an asp.net web page. I think this will help you.

---------
Using System.Data.SqlClient
void Page_Load()
{
SqlConnection con=new SqlConnection ("server=labserver;database=testdb;username=sa;passw ord=s");
SqlCommand cmd=new SqlCommand("insert into emptable(empid,empname) values(2312,'Adam')",con);
con.open();
cmd.ExecuteNonQuery();
con.close();
}
----------|||

Quote:

Originally Posted by balajiu

Hi ,

I don't know which platform you are using to develop your webpage.I give you sample code here to insert data into a sql server database table from an asp.net web page. I think this will help you.

---------
Using System.Data.SqlClient
void Page_Load()
{
SqlConnection con=new SqlConnection ("server=labserver;database=testdb;username=sa;passw ord=s");
SqlCommand cmd=new SqlCommand("insert into emptable(empid,empname) values(2312,'Adam')",con);
con.open();
cmd.ExecuteNonQuery();
con.close();
}
----------


tnx ill try your code out

No comments:

Post a Comment