Hi,
I'm expecting to get an extra column named 'state' displayed in the
datagrid but it doesnt add one.
Can you please help me find out the problem with the source code.
SqlConnection myConnection = new SqlConnection(
"server=(local);database=demo;Integrated Security=SSPI");
SqlDataAdapter myCommand = new SqlDataAdapter ("select * from demo",
myConnection);
/* myCommand.SelectCommand.Parameters.Add(new SqlParameter("@State",
SqlDbType.NVarChar, 2));
myCommand.SelectCommand.Parameters["@State"].Value = MySelect.Value
*/
try
{
myCommand.SelectCommand.Parameters.Add(new
SqlParameter("@State",SqlDbType.NVarChar,2));
myCommand.SelectCommand.Parameters["@State"].Value = "aa";
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
DataSet ds = new DataSet();
myCommand.Fill(ds, "mytable");
DataGrid1.BorderColor=Color.Black;
DataGrid1.BorderWidth=1;
DataGrid1.GridLines=GridLines.Both;
DataGrid1.CellPadding=3;
DataGrid1.CellSpacing=0;
DataGrid1.HeaderStyle.BackColor=Color.FromArgb(0xa aaadd);
DataGrid1.DataSource=ds.Tables["mytable"].DefaultView;
DataGrid1.DataBind();
Yours sincerely
Andla
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!