If an SQL connection is already created, and a data table is created that takes input from an excel sheet, how do I use the SP in order to load the data table into the datagridview on my desktop appl开发者_如何学Goication (Visual Studio 2008, Sql Server 2005 are being used)?
try this :
DataTable t = new DataTable();//in your case it's filled already like below or any other method
c.Open();
using (SqlCeDataAdapter a = new SqlCeDataAdapter("SELECT CO_COMP_ID as Company_Id,CO_COMP_NAME as Company_Name, CO_ACTIVE as Active_Status, CO_FILE_TYPE as Using_File_Type, CO_DESC as Description FROM CompRegister", c))
{
a.Fill(t);
//dgvCompDet.DataSource = t;
fnDeselectRow();
}
c.Close();
Give data table as data source to datagrid
dgvCompDet.DataSource = t;
精彩评论