kevlause
asked on
Timeout Expired when trying to bind gridview with sql datasource
I've got a grid view that is bound to a sql datasource that uses a connection string set in a web config file.
When I run a large sql query I get the time out error. I've set the timeout in the connection string (I think) but I'm still getting this error.
System.Data.SqlClient.SqlE xception: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Here is the connection string I'm using
connectionString="Data Source=XXX;Initial Catalog=XXX;Integrated Security=True;timeout=9999 999"
What else do I need to do here? Is there a time out I can set on the server it's self?
When I run a large sql query I get the time out error. I've set the timeout in the connection string (I think) but I'm still getting this error.
System.Data.SqlClient.SqlE
Here is the connection string I'm using
connectionString="Data Source=XXX;Initial Catalog=XXX;Integrated Security=True;timeout=9999
What else do I need to do here? Is there a time out I can set on the server it's self?
ASKER
Where?
What is objconnection? I've set the datasource for my datagrid to sqldatasource2.
What is objconnection? I've set the datasource for my datagrid to sqldatasource2.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I set the connectionstring in the webconfig file
<connectionStrings>
<add name="xxxConnectionString" connectionString="Data Source=xxx;Initial Catalog=xxx;Integrated Security=True;timeout=9999 999" providerName="System.Data. SqlClient" />
</connectionStrings>
Then in my ASPX page I have this code:
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:XXXConne ctionStrin g %>">
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False " DataSourceID="SqlDataSourc e2" />
I set SqlDataSource2.SelectComma nd in the code behind page.
This is where I'm stuck because I never actually "create" the ADODB connection
<connectionStrings>
<add name="xxxConnectionString"
</connectionStrings>
Then in my ASPX page I have this code:
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:XXXConne
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False
I set SqlDataSource2.SelectComma
This is where I'm stuck because I never actually "create" the ADODB connection
nito8300,
The questioner is not using ADO but rather ADO.NET.
The questioner is not using ADO but rather ADO.NET.
ASKER
Well let me offer this, Should I cange what I'm doing to allow this to work? Should I fill a data table and use that as my source?
thanks acperkins. sorry kev. maybe this will help http://www.connectionstring.com/
ASKER
It's as easy as this!!
Protected Sub SqlDataSource1_Selecting(B yVal Sender As Object, ByVal e As System.web.ui..webcontrols .sqldataso urceselect ingeventar gs) handles sqldatasource1.selecting
e.command.commandtimeout = 0
end sub
Thanks for heading me in the right direction!
Protected Sub SqlDataSource1_Selecting(B
e.command.commandtimeout = 0
end sub
Thanks for heading me in the right direction!
You are welcome.
objConnection.ConnectionTi
objConnection.CommandTimeo