Click here to Skip to main content
16,018,353 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can anyone help me for my problem, i'm already using inner join but its still error on my code.
Here the error i got :
ERROR [57014] ERROR: canceling statement due to statement timeout;
Error while executing the query


What I have tried:

Here my code what i have use it :
conn.Open()
        da = New OdbcDataAdapter("select poss_tenants.gerai_name, substring(detail_trans.trans_time, 1,6) as Bulan, detail_trans.item_name, sum(detail_trans.qty_item) as qty, detail_trans.price_exctax from poss_tenants inner join " & _
                                 "detail_trans on poss_tenants.poss_id=detail_trans.poss_id where detail_trans.trans_time between '" & date1.Text & "' and '" & date2.Text & "' and detail_trans.poss_id='" & possidtxt.Text & "' and detail_trans.type='ITEM' " & _
                                 "group by poss_tenants.gerai_name, substring(detail_trans.trans_time, 1,6),detail_trans.item_name,detail_trans.price_exctax order by qty asc limit 15", conn)
        ds = New DataSet
        ds.Clear()
        da.Fill(ds, "top15")
        conn.Close()
        dgv1.DataSource = (ds.Tables("top15"))
        conn.Close()
VB

Posted
Comments
Graeme_Grant 5-Sep-17 23:53pm    
"ERROR [57014] ERROR: canceling statement due to statement timeout;" this is unrelated to: "How to create view into datagridview with 2 tables in VB.NET?". It is saying that the query is taking too long. Fix this first, then you can ask your question if you have further issues that you and Google Search can't resolve.
Member 11975501 6-Sep-17 0:25am    
can you tell me spesific which i must to fix it? it is the connection or my code?
Graeme_Grant 6-Sep-17 0:30am    
da = New OdbcDataAdapter("select poss_tenants.gerai_name, substring(detail_trans.trans_time, 1,6) as Bulan, detail_trans.item_name, sum(detail_trans.qty_item) as qty, detail_trans.price_exctax from poss_tenants inner join " & _                                 "detail_trans on poss_tenants.poss_id=detail_trans.poss_id where detail_trans.trans_time between '" & date1.Text & "' and '" & date2.Text & "' and detail_trans.poss_id='" & possidtxt.Text & "' and detail_trans.type='ITEM' " & _                                 "group by poss_tenants.gerai_name, substring(detail_trans.trans_time, 1,6),detail_trans.item_name,detail_trans.price_exctax order by qty asc limit 15", conn)


Does this actually work? For starters, you don't catenate, you use parameters for queries. This needs debugging and fixing. Only you have access to your database, so only you can fix it. It is called "programming" and "debugging".
Member 11975501 6-Sep-17 1:27am    
can you give me example, how to create or use parameters for queries?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900