1. you need to use a same table name:myCommand.Fill(ds,"names"); MyDataGrid.DataSource=ds.Tables["Categories"].DefaultView; ======> myCommand.Fill(ds,"names"); MyDataGrid.DataSource=ds.Tables["names"].DefaultView;2.do not recommend "server=(local);database=TestSql;Trusted_Connection=yes;"use SQL Authentication instead: "server=(local);database=TestSql;UID=YourDBLoginID;PWD=YourDBPassword;"3. by the way, you do not have any templates in asp:datagrid, you might want to set AutoGenerateColumns="true"
MyDataGrid.DataSource=ds.Tables["Categories"].DefaultView;
======>
myCommand.Fill(ds,"names");
MyDataGrid.DataSource=ds.Tables["names"].DefaultView;2.do not recommend
"server=(local);database=TestSql;Trusted_Connection=yes;"use SQL Authentication instead:
"server=(local);database=TestSql;UID=YourDBLoginID;PWD=YourDBPassword;"3. by the way, you do not have any templates in asp:datagrid, you might want to set
AutoGenerateColumns="true"