1) I need to be able to add parametres to my SQL statements within my table adapter, however I don't know how to do this?
Here is a very good article on TableAdapters with Parametrized Query
ConfusedMonl29
Hey,
2) I have a table, who's column names are the days of the week (Monday to Sunday), the rows contained within this table read true or false. I need to create a table adapter that shades the days that are returned false by the database.
Can you show your table & the query as u did in ur 1st post?
ConfusedMonl...
Member
48 Points
140 Posts
Thanks!
Jan 20, 2011 05:12 PM|LINK
Thanks!
ConfusedMonl...
Member
48 Points
140 Posts
Re: Thanks!
Jan 21, 2011 10:31 AM|LINK
Bump.
nilsan
All-Star
17528 Points
3824 Posts
Re: Thanks!
Jan 21, 2011 10:35 AM|LINK
Does your GetData() method accepts any date parameter?
Blog | Get your forum question answered | Microsoft Community Contributor 2011
ConfusedMonl...
Member
48 Points
140 Posts
Re: Thanks!
Jan 21, 2011 11:18 AM|LINK
Thanks!
nikhilgupta
Member
674 Points
204 Posts
Re: Thanks!
Jan 23, 2011 11:46 AM|LINK
Just change ta.GetData(e.Day.Date) to ta.GetData()
Reason be Your table adapter's GetData method & the underlying sql query does not use Parameters.
ConfusedMonl...
Member
48 Points
140 Posts
Re: Thanks!
Jan 23, 2011 12:07 PM|LINK
Thanks!
nikhilgupta
Member
674 Points
204 Posts
Re: Thanks!
Jan 23, 2011 03:11 PM|LINK
Try this.
protected void monthlyCal_DayRender(object sender, DayRenderEventArgs e)
{
DataSet1TableAdapters.HolidaysTableAdapter ta = new HolidaysTableAdapter();
DataTable dt = ta.GetData();
foreach (DataRow dr in dt.Rows)
{
if (DateTime.Parse(dr["Date"].ToString()) == e.Day.Date)
e.Cell.BackColor = System.Drawing.Color.Blue;
}
}
ConfusedMonl...
Member
48 Points
140 Posts
Re: Thanks!
Jan 23, 2011 03:18 PM|LINK
Thanks!
nikhilgupta
Member
674 Points
204 Posts
Re: Thanks!
Jan 23, 2011 04:41 PM|LINK
Here is a very good article on TableAdapters with Parametrized Query
Can you show your table & the query as u did in ur 1st post?
ConfusedMonl...
Member
48 Points
140 Posts
Re: Thanks!
Jan 23, 2011 05:36 PM|LINK
Thanks!