Click here to Skip to main content
15,896,040 members

Comments by XCode2010 (Top 6 by date)

XCode2010 11-Sep-14 7:09am View    
Man this is my sql statement. How can I make that through this.

<pre lang="SQL">

SELECT Customer_Transaction.Order_Number, Customer_Purchased.ProductID, Customer_Purchased.productName, Customer_Purchased.Branch,
Customer_Purchased.quantity, Customer_Transaction.Total_Purchased, Customer_Purchased.Date_Purchased
FROM Customer_Purchased INNER JOIN
Customer_Transaction ON Customer_Purchased.Item_Purchased_Number = Customer_Transaction.Item_Purchased_Number
WHERE (Customer_Purchased.Branch = 'SM Dasmariñas') AND (Customer_Purchased.Date_Report BETWEEN '9/1/2010' AND '9/15/2010')
</pre>
XCode2010 9-Sep-14 22:49pm View    
Wtf! I don't see that. Haha. Sorry man and thanks ;)
XCode2010 3-Sep-14 11:13am View    
Yes, its doesn't show on my gridviews. Can you suggest me better ways to create a report in that query? BTW this is my gridview and thanks for answering.

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
EmptyDataText="There are no data records to display." BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4"
CellSpacing="2" ForeColor="Black" Width="726px">
<columns> <asp:BoundField DataField="Order_Number" HeaderText="Order #"
SortExpression="Order_Number" />
<asp:BoundField DataField="Item_Purchased_Number"
HeaderText="Purchased #" SortExpression="Item_Purchased_Number" />
<asp:BoundField DataField="ProductID" HeaderText="ProductID"
SortExpression="ProductID" />
<asp:BoundField DataField="productName" HeaderText="productName"
SortExpression="productName" />
<asp:BoundField DataField="quantity" HeaderText="quantity"
SortExpression="quantity" />
<asp:BoundField DataField="Branch" HeaderText="Branch"
SortExpression="Branch" />
<asp:BoundField DataField="Date_Purchased" HeaderText="Date_Purchased"
SortExpression="Date_Purchased" />
<footerstyle backcolor="#CCCCCC">
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<rowstyle backcolor="White">
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<sortedascendingcellstyle backcolor="#F1F1F1">
<sortedascendingheaderstyle backcolor="#808080">
<sorteddescendingcellstyle backcolor="#CAC9C9">
<sorteddescendingheaderstyle backcolor="#383838">
XCode2010 2-Sep-14 4:45am View    
SqlCommand cmd = new SqlCommand("SELECT Customer_Transaction.Order_Number, Customer_Purchased.ProductID, Customer_Purchased.productName, Customer_Transaction.Branch, Customer_Purchased.quantity, Customer_Purchased.Date_Report FROM Customer_Purchased INNER JOIN Customer_Transaction ON Customer_Purchased.Item_Purchased_Number = Customer_Transaction.Item_Purchased_Number WHERE Customer_Purchased.Date_Report >='" + startdate + "' AND Customer_Purchased.Date_Purchased <='" + enddate + "'");


->> I USE THE TECHNIQUE YOU THOUGHT ME SIR MAXX AND IT WORKS THE PROBLEM IS IT NOW SHOW ON MY GRIDVIEW.
XCode2010 2-Sep-14 4:33am View    
protected void Button2_Click(object sender, EventArgs e)
{
string startdate = ddlDay.Text + "/" + ddlMonth.Text + "/" + ddlYear.Text;
string enddate = ddlDay2.Text + "/" + ddlMonth2.Text + "/" + ddlYear2.Text;
SqlCommand cmd = new SqlCommand("SELECT Customer_Transaction.Order_Number, Customer_Purchased.ProductID, Customer_Purchased.productName, Customer_Transaction.Branch, Customer_Purchased.quantity, Customer_Purchased.Date_Report FROM Customer_Purchased INNER JOIN Customer_Transaction ON Customer_Purchased.Item_Purchased_Number = Customer_Transaction.Item_Purchased_Number WHERE Date_Report BETWEEEN'" + startdate + "'AND'" + enddate + "'");
DataTable dt = GetData(cmd);
GridView1.DataSource = dt;
GridView1.DataBind();
}

This is my code and I got an error "An expression of non-boolean type specified in a context where a condition is expected, near 'BETWEEEN'." Can you help me sir MAXXX?