G
Guest
im getting the dreaded:
Object reference not set to an instance of an object.
on the code below. pretty new to C# but i know im missing something basic here.
any help is appreciated
thanks
rik
public void GetEEs()
{
SqlConnection myConnection = new SqlConnection("Data Source=(Local);Initial Catalog=A39;Integrated Security=SSPI");
SqlDataAdapter da = new SqlDataAdapter("GetAuditTimeCard",myConnection);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@PERIOD",SqlDbType.DateTime,8);
da.SelectCommand.Parameters["@PERIOD"].Value = txtPpe.Text;
DataSet ds = new DataSet();
myConnection.Open();
da.Fill(ds);
Dg1.DataSource = ds.Tables["TimeCard"].DefaultView;
Dg1.DataBind();
da.Dispose();
myConnection.Close();
}
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Object reference not set to an instance of an object.
on the code below. pretty new to C# but i know im missing something basic here.
any help is appreciated
thanks
rik
public void GetEEs()
{
SqlConnection myConnection = new SqlConnection("Data Source=(Local);Initial Catalog=A39;Integrated Security=SSPI");
SqlDataAdapter da = new SqlDataAdapter("GetAuditTimeCard",myConnection);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@PERIOD",SqlDbType.DateTime,8);
da.SelectCommand.Parameters["@PERIOD"].Value = txtPpe.Text;
DataSet ds = new DataSet();
myConnection.Open();
da.Fill(ds);
Dg1.DataSource = ds.Tables["TimeCard"].DefaultView;
Dg1.DataBind();
da.Dispose();
myConnection.Close();
}
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...