Timeout at runtime but no timeout at design time in VS2003

  • Thread starter Thread starter Patrice Raucq
  • Start date Start date
P

Patrice Raucq

Hi all,

I have a timeout problem when retrieving data from my DB in a C# program.

Everything is OK at design time : I can generate a Dataset and populate it
with its data.

Important note : the View1 is based on a UserDefined function returning a
table variable, it takes 54 seconds to retrieve the data in SQL Analyser and
approximatly the same in the VS designer.

At runtime, this usual code crashes :
-----------------------------------------------
sqlConnection1.Open();
try
{
sqlDataAdapter1.Fill(dataSet11); // crashes here.
dataGrid1.DataSource = dataSet11;
dataGrid1.DataSource = "View1";
}
catch (Exception erreur)
{
MessageBox.Show(erreur.Message);
}
sqlConnection1.Close();
-----------------------------------------------



1. How can the designer work differently ?
2. Where could I tell my connection to wait a longer time ?

Thanks in advance,

Patrice.
 
Cor,

Thanks, it works, the dataset is correctly filled.

Remark : using the MS datagrid gives an error : "Complex DataBinding
accepts IList or IListSource as datasource" (translated from French)
If I use Developer Express dataGrid, no error ...

Patrice.
 
Patrice,

For this you would have at least to show the way you set that datasource,

However is strange, because the MS datagrid accept almost everything.
(That does not mean that it shows than always something)

:-)

Cor
 
Cor,

I connect the datagrid like this :

dataGrid1.DataSource = dataSet11;
dataGrid1.DataSource = "View1";

The code is the same for the DevExpress Datagrid.
Anyway it is enough for me to go further.

Thanks (Dank U ;-) )

Patrice.
 
Patrice,

I did not recognize you where from Belgium :-). Not at the moment however
there are sometimes many Dutch speaking Belgs active in these dotNet
newsgroups. You see DraguVaso (Pieter), he is from Belgium.

However, your problem what is "View1"
dataGrid1.DataSource = dataSet11;
dataGrid1.DataSource = "View1";

I assume this is a kind of typo because this will as you said give an error.

Cor
 
Cor,

Sorry, I think I don't get your point with :
For this you would have at least to show the way you set that datasource,

I'll try an answer ...
the view View1 is based on a UserDefined Function in SQL Server.
this function makes a lot of select ... into a @table and gives this table
back.
the T-SQL code for the view is :
----------------------------------
CREATE VIEW dbo.V_ETUDIANTS_POINTS_TOTAL_REL_GROUPES_DELIBERATION
AS
SELECT C_GUID_ETUDIANT, C_GUID_ANNEE_ACADEMIQUE, C_INSCRIPTION,
C_GUID_TYPE_PERIODE, C_NOM, C_PRENOM_1, N_MATRICULE,
C_CODE_ANNEE_ACADEMIQUE, C_LIBELLE_ANNEE_ACADEMIQUE,
C_CODE_TYPE_PERIODE, C_LIBELLE_TYPE_PERIODE, MOYENNE,
C_GUID_GROUPE_DELIBERATION
FROM dbo.fnV_ETUDIANTS_POINTS_TOTAL_REL_GROUPES_DELIBERATION()
fnV_ETUDIANTS_POINTS_TOTAL_REL_GROUPES_DELIBERATION
----------------------------------

where dbo.fnV_ETUDIANTS_POINTS_TOTAL_REL_GROUPES_DELIBERATION() is the user
defined function.
in VS, I then can point to the view.

By the way, I'm a French speaking Belgian, but Dutch is not a problem wich
is a good thing to go to the TechEd Amsterdam ! :-)))

Patrice.
 
Patrice,

I never saw that approach. Probably I learned again something a normal
dataset is based on a Select statement.

However you have created a so called strongly typed dataset.
That you can use as well non strongly typed.

Can you try what this gives for results.
dataGrid1.DataSource = dataSet11;
dataGrid1.DataSource = dataset1.Tables[0]; //this is the non strongly typed
format

And than not that "View1", because that gives the error.

Or do a command as
MessageBox.Show(dataset1.Tables[0].TableName);

Cor
 
Cor,

You got it !
It was not a typo, I really wrote DataSource twice, (hum, let's say it is
intellisense :-) ) ...
One good night on it and I was able to see it.
So, the timeout problem is ok and the datagrid one too.

Thanks a lot,

Patrice.
 
Back
Top