design the table and send the code.
please help me
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
SenthilkumarPosted Mar 17, 2012, 12:52 AM
select the appropriate database in sql server and create the below table.
CREATE TABLE Employees
(
iEmployeeID INT INDENTITY(1,1) PRIMARY KEY
,Name VARCHAR(100) NOT NULL
,Address VARCHAR(100) NOT NULL
,City VARCHAR(100) NOT NULL
,State VARCHAR(100) NOT NULL
,Country VARCHAR(100) NOT NULL
,Email VARCHAR(100) NOT NULL
,Mobile VARCHAR(100) NOT NULL
)
GO
Insert some rows for testing.
Place code asp:gridview control in your page and write the logic to load the data from the database. See the above post to get the results.
When you mention autogeneratecoulmns is tru then it will render the table as database table.
Satyapriya NayakPosted Mar 14, 2012, 12:52 PM
If you want to display records in a datagrid from database use below code.
using System.Data;
using System.Data.SqlClient;
SqlConnection con=new SqlConnection();
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
string str;
private void btnload_Click(object sender, System.EventArgs e)
{
con.Open();
str="select * from student";
com=new SqlCommand(str,con);
sqlda=new SqlDataAdapter(com);
ds=new DataSet();
sqlda.Fill(ds,"student");
dataGrid1.DataSource=ds;
dataGrid1.DataMember=("student");
con.Close();
}
Thanks