Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > General> dao.GetAsDataReader return nothing.
 

Pages: 1
General
dao.GetAsDataReader return nothing.
Page:1/1 

  Print all messages in this thread  
Poster Message
nevernet
User



Location:

Joined on:
01-Feb-2010 13:21:09
Posted:
67 posts
# Posted on: 11-May-2010 11:03:35.  
Code:

IRetrievalQuery query = new RetrievalQuery(commandToUse);
        IDataReader reader = null;
        try
        {
            reader = dao.GetAsDataReader(null, query, CommandBehavior.Default);
            while (reader.Read())
            {
                Response.Write(string.Format("Amount:{0},CategoryId:{1},Name:{2}", info.Amount, info.CategoryId, info.Name));
            }

            //reader.Close();
        }
        catch (Exception exc)
        {
            throw exc;
        }
        finally
        {
            if (reader != null)
                reader.Close();
        }


query as follow:
Code:

{
    Query: call Expenses(@actionTypeId,@isSchedule,@userId,@dateStart,@dateEnd)
    Parameter: actionTypeId : AnsiString. Length: 1. Precision: 0. Scale: 0. Direction: Input. Value: "1".
    Parameter: isSchedule : AnsiString. Length: 1. Precision: 0. Scale: 0. Direction: Input. Value: "0".
    Parameter: userId : Int32. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 1.
    Parameter: dateStart : AnsiString. Length: 10. Precision: 0. Scale: 0. Direction: Input. Value: "2010-01-01".
    Parameter: dateEnd : AnsiString. Length: 10. Precision: 0. Scale: 0. Direction: Input. Value: "2010-05-11".
}


the DB is MySQL 5.0
the result should have 5 rows.

current problem is : dao.GetAsDataReader return nothing.

please advise.
Thank you.
Dev Environment as below:
.Net 3.5, LLBLGen Pro 2.6, SQLServer 2008, IIS7
 
Top
MTrinder
User



Location:
London by day, Milton Keynes by night.
Joined on:
08-Oct-2008 17:55:47
Posted:
1461 posts
# Posted on: 11-May-2010 18:02:12.  
How is the commandToUse object created/setup ?



  Top
nevernet
User



Location:

Joined on:
01-Feb-2010 13:21:09
Posted:
67 posts
# Posted on: 12-May-2010 01:51:42.  
how should i create commandToUse?
my way as follows:
first:

Code:

IDbCommand commandToUse = DynamicQueryEngine.FactoryToUse.CreateCommand();
        commandToUse.CommandText = "call Expenses(@actionTypeId,@isSchedule,@userId,@dateStart,@dateEnd)";
        commandToUse.CommandType = CommandType.Text;
        
        IDataParameterCollection parameters = commandToUse.Parameters;

        DbParameter pActionTypeId = DynamicQueryEngine.FactoryToUse.CreateParameter();
        pActionTypeId.ParameterName = "actionTypeId";
        pActionTypeId.Value = "1";
        commandToUse.Parameters.Add(pActionTypeId);

        ......


second way is change "DynamicQueryEngine.FactoryToUse.CreateCommand();" to "new Devart.Data.MySql.MySqlCommand();"
and change "DynamicQueryEngine.FactoryToUse.CreateParameter();" to "new Devart.Data.MySql.MySqlParameter();"

becuase my MySql provider is Devart.Data.MySql.

Thank you.
Dev Environment as below:
.Net 3.5, LLBLGen Pro 2.6, SQLServer 2008, IIS7
 
Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
7642 posts
# Posted on: 12-May-2010 03:09:43.  
In your first post I don't get what "info" is. And the obvious question is: What you are not using a call to stored procedure via LLBLGen (read Calling a stored procedure).

David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
nevernet
User



Location:

Joined on:
01-Feb-2010 13:21:09
Posted:
67 posts
# Posted on: 12-May-2010 03:11:33.  
LLBL 2.6 doesn't support call Sp in Mysql.
Dev Environment as below:
.Net 3.5, LLBLGen Pro 2.6, SQLServer 2008, IIS7
 
Top
nevernet
User



Location:

Joined on:
01-Feb-2010 13:21:09
Posted:
67 posts
# Posted on: 12-May-2010 04:29:40.  
the problem was solved by myself.

commandToUse.CommandText should be changed to

Code:
commandToUse.CommandText = "call Expenses(?,?,?,?,?)";


Dev Environment as below:
.Net 3.5, LLBLGen Pro 2.6, SQLServer 2008, IIS7
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.