Dim myDateTime As DateTime = DateTime.Now Dim month As String = myDateTime.Month.ToString() Label4.Text = "<b>Todays Date:</b> " & DateTime.Now.ToLongDateString() Label4.Text += "<br /><b>Period:</b>" & month
Without the WHERE statement the code outputs:
Todays Date: 9th April 2012
Month: 4
That month number from the Label4.Text needs to match the p_id P_k field in
the mocSetsTbl. This will enable me to display all records for the month of April in a GridView
I-Weedy
Member
67 Points
239 Posts
Re: convert month datetime string to integer and place in select statement!
Apr 08, 2012 10:20 PM|LINK
Dim where As String???
Not really following why you're using WHERE as a variable? Maybe I explain my problem incorrectly!
This is not in code behind but in design source view.
The method you've supplied seems to throw up the same error!
This is the exact WHERE STATEMENT I have in the source code
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
WHERE [mocSetsTbl].[p_id] = ' & month ' "
and this is in the codebehind.
Dim myDateTime As DateTime = DateTime.Now
Dim month As String = myDateTime.Month.ToString()
Label4.Text = "<b>Todays Date:</b> " & DateTime.Now.ToLongDateString()
Label4.Text += "<br /><b>Period:</b>" & month
Without the WHERE statement the code outputs:
Todays Date: 9th April 2012
Month: 4
That month number from the Label4.Text needs to match the p_id P_k field in the mocSetsTbl. This will enable me to display all records for the month of April in a GridView
Need this resolving ASAP