[Mono-list] anyone got bDataAdapter.Fill Method work?

Dennis Boylan mono@b-lan.com
Tue, 13 Jul 2004 14:20:42 -0400


On Mon, Jul 12, 2004 at 10:59:30PM -0600, S Umadevi wrote:
> Hi Denis/Igor
> Does Test2 and Test3 below work?

Both Test2 and Test3 work.


> Also can you send me the the database table schema ( for the table you
> are querying), along with the values in the  first row.

In the case of test2/3, the table does not have any data.  Pointing it to
the production database, I get test2 and test3 to return all 8 rows from
the database.

Here is the exerp of create script:
CREATE TABLE [dbo].[Network] (
        [Id] [int] IDENTITY (1, 1) NOT NULL ,
        [Version] [int] NOT NULL ,
        [Parent] [int] NOT NULL ,
        [Name] [nvarchar] (40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
        [AddrType] [tinyint] NOT NULL ,
        [FitStyle] [tinyint] NOT NULL ,
        [NtwkType] [tinyint] NOT NULL ,
        [MinBorrow] [tinyint] NOT NULL ,
        [MaxBorrow] [tinyint] NOT NULL ,
        [ReuseDay] [int] NOT NULL ,
        [Note] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
        [XId] [int] NULL
) ON [PRIMARY]
ALTER TABLE [dbo].[Network] WITH NOCHECK ADD
        CONSTRAINT [PK_Network] PRIMARY KEY  CLUSTERED
        (
                [Id]
        )  ON [PRIMARY]
 CREATE  UNIQUE  INDEX [IX_NtwkIdVer] ON [dbo].[Network]([Id], [Version]) ON [PRIMARY]
 CREATE  UNIQUE  INDEX [IX_ParentIdName] ON [dbo].[Network]([Parent], [Name]) ON [PRIMARY]
 CREATE  INDEX [IX_NtwkAddrType] ON [dbo].[Network]([AddrType]) ON [PRIMARY]
CREATE PROCEDURE [GetNtwkNEType]
        ( @AddrType     [tinyint])
 AS
Select * From [Network] Where [AddrType] != @AddrType
Order By Parent, Name

> 
> Would also be useful if you can send the enitre stack trace of the
> exception below..

Here is the complete trace:
Server error in '/' application
Description: Error processing request.

Error Message: HTTP 500.

Stack Trace:

System.Data.SqlClient.SqlException: Error converting data type nvarchar to tinyint.
in [0x00034] (at /tmp/snapshot/20040712/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs:204) System.Data.SqlClient.SqlConnection:ErrorHandler (object,Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
in <0x00069> (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_TdsInternalErrorMessageEventArgs (object,Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
in [0x00019] (at /tmp/snapshot/20040712/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1076) Mono.Data.Tds.Protocol.Tds:OnTdsErrorMessage (Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
in <0x00056> (wrapper remoting-invoke-with-check) Mono.Data.Tds.Protocol.Tds:OnTdsErrorMessage (Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
in [0x000fe] (at /tmp/snapshot/20040712/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1117) Mono.Data.Tds.Protocol.Tds:ProcessMessage (Mono.Data.Tds.Protocol.TdsPacketSubType)
in <0x00052> (wrapper remoting-invoke-with-check) Mono.Data.Tds.Protocol.Tds:ProcessMessage (Mono.Data.Tds.Protocol.TdsPacketSubType)
in [0x00130] (at /tmp/snapshot/20040712/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1164) Mono.Data.Tds.Protocol.Tds:ProcessSubPacket ()
in [0x00017] (at /tmp/snapshot/20040712/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:278) Mono.Data.Tds.Protocol.Tds:NextResult ()
in [0x0003c] (at /tmp/snapshot/20040712/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs:832) System.Data.SqlClient.SqlDataReader:NextResult ()
in <0x0005d> (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlDataReader:NextResult ()
in [0x00076] (at /tmp/snapshot/20040712/mcs/class/System.Data/System.Data.SqlClient/SqlDataReader.cs:82) System.Data.SqlClient.SqlDataReader:.ctor (System.Data.SqlClient.SqlCommand)
in <0x00056> (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlDataReader:.ctor (System.Data.SqlClient.SqlCommand)
in [0x0002c] (at /tmp/snapshot/20040712/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:348) System.Data.SqlClient.SqlCommand:ExecuteReader (System.Data.CommandBehavior)
in <0x00054> (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlCommand:ExecuteReader (System.Data.CommandBehavior)
in [0x00002] (at /tmp/snapshot/20040712/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:421) System.Data.SqlClient.SqlCommand:System.Data.IDbCommand.ExecuteReader (System.Data.CommandBehavior)
in [0x00026] (at /tmp/snapshot/20040712/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:247) System.Data.Common.DbDataAdapter:Fill (System.Data.DataTable,System.Data.IDbCommand,System.Data.CommandBehavior)
in [0x00015] (at /tmp/snapshot/20040712/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:204) System.Data.Common.DbDataAdapter:Fill (System.Data.DataTable)
in <0x00058> (wrapper remoting-invoke-with-check) System.Data.Common.DbDataAdapter:Fill (System.Data.DataTable)
in [0x00092] (at /home/dennis/Dev/new/DbLayer/Network.cs:1070) IA.DbLayer.DBNetwork:GetDTNetwork (int)
in [0x00002] (at /home/dennis/Dev/new/DbLayer/Network.cs:1028) IA.DbLayer.DBNetwork:ToXmlFile (System.IO.TextWriter,int)
in [0x00009] (at /home/dennis/Dev/new/DbLayer/Network.cs:1023) IA.DbLayer.DBNetwork:GetNetworkXml (int)
in [0x00060] (at /home/dennis/Dev/new/DbLayer/DbXPage.cs:243) IA.DbLayer.XApi:GetNtwkXml (System.Web.HttpContext)
in [0x00006] (at /home/dennis/Dev/new/IPal/IPalPage.cs:104) IA.IPal.IPalPage:GetNtwkXml ()
in [0x00023] (at /home/dennis/Dev/new/IPal/Login.aspx.cs:354) IA.IPal.Login:StartPicker ()
in [0x00016] (at /home/dennis/Dev/new/IPal/Login.aspx.cs:343) IA.IPal.Login:RunDailyChore ()
in [0x00053] (at /home/dennis/Dev/new/IPal/Login.aspx.cs:164) IA.IPal.Login:Page_Load (object,System.EventArgs)
in <0x00069> (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
in [0x00030] (at /tmp/snapshot/20040712/mcs/class/System.Web/System.Web.UI/Control.cs:574) System.Web.UI.Control:OnLoad (System.EventArgs)
in [0x00056] (at /home/dennis/Dev/new/IPal/IPalPage.cs:351) IA.IPal.IPalPage:OnLoad (System.EventArgs)
in [0x00006] (at /tmp/snapshot/20040712/mcs/class/System.Web/System.Web.UI/Control.cs:809) System.Web.UI.Control:LoadRecursive ()
in [0x000b7] (at /tmp/snapshot/20040712/mcs/class/System.Web/System.Web.UI/Page.cs:747) System.Web.UI.Page:InternalProcessRequest ()
in [0x00052] (at /tmp/snapshot/20040712/mcs/class/System.Web/System.Web.UI/Page.cs:720) System.Web.UI.Page:ProcessRequest (System.Web.HttpContext)
in [0x00091] (at /tmp/snapshot/20040712/mcs/class/System.Web/System.Web/HttpApplication.cs:444) ExecuteHandlerState:Execute ()
in [0x0001e] (at /tmp/snapshot/20040712/mcs/class/System.Web/System.Web/HttpApplication.cs:708) StateMachine:ExecuteState (System.Web.HttpApplication/IStateHandler,bool&)

- Dennis
> 
> Regards
> Uma
> 
> >>> Dennis Boylan <mono@b-lan.com> 7/13/2004 2:52:28 AM >>>
> I'm trying to chase this down myself.  I've got a .NET application
> which
> runs fine under the Microsoft runtime, but I get a:
> 
> System.Data.SqlClient.SqlException: Error converting data type nvarchar
> to tinyint.
> 
> while trying to run the same application under mono.
> 
> I thought it was fill as well because the traceback looks like this:
> 
> in <0x00058> (wrapper remoting-invoke-with-check)
> System.Data.Common.DbDataAdapter:Fill (System.Data.DataTable)
> in [0x00092] (at /home/dennis/Dev/new/DbLayer/Network.cs:1070)
> IA.DbLayer.DBNetwork:GetDTNetwork (int)
> 
> Where GetDTNetwork is trying to fill a DataTable with the values from
> a
> MS SQL database on a remote machine.  It is the last part of my
> application
> code before it gets lost in the weeds.
> 
> I thought it might be because the table was empty, so I wrote a little
> standalone app to test it.  The standalone app works.
> 
> My first test was trying it without using my stored procedure.  It was
> called test2.  The second uses a stored procedure like the application
> normally does.  It was called test3.
> 
> These were my best approximations of what the code at the location was
> trying to do.  The real code hides the type of database, so direct
> examples
> would not be all that useful.
> 
> Now, mind you, I'm trying this on the bleeding edge.
> [dennis@Shuttle test]$ mono -V
> Mono JIT compiler version 1.0.20040712, (C) 2002-2004 Novell, Inc and
> Contributors. www.go-mono.com 
>         TLS:           __thread
>         GC:            Included Boehm (with typed GC)
>         SIGSEGV      : normal
>         Globalization: ICU
> 
> - Dennis
> 
> -- test2.cs --
> 
>  using System;
>  using System.Data;
>  using System.Data.Common;
>  using System.Data.SqlClient;
> 
>  public class Test
>  {
>      public static void Main(string[] args)
>      {
>         string connectionString =
>               "Address=hp,1434;" +
>               "Database=Linux;" +
>               "User ID=test;" +
>               "Password=test;";
>         IDbConnection dbcon;
>         dbcon = new SqlConnection(connectionString);
>         dbcon.Open();
>         IDbCommand dbcmd = dbcon.CreateCommand();
>         string sql = "SELECT Name, Parent " +
> 	             "FROM Network";
>         dbcmd.CommandText = sql;
>         DataTable dtNtwk = new DataTable("Network");
>         DbDataAdapter dbAdptr = new SqlDataAdapter((SqlCommand)dbcmd);
>         int iRows = dbAdptr.Fill(dtNtwk);
> 	Console.WriteLine ("Returned " + iRows + " rows");
>         dbcon.Close();
>         dbcon = null;
>     }
> }
> 
> -- test3.cs --
>  using System;
>  using System.Data;
>  using System.Data.Common;
>  using System.Data.SqlClient;
> 
>  public class Test
>  {
>      public static void Main(string[] args)
>      {
>         string connectionString =
>               "Address=hp,1434;" +
>               "Database=Linux;" +
>               "User ID=test;" +
>               "Password=test;";
>         IDbConnection dbcon;
>         dbcon = new SqlConnection(connectionString);
>         dbcon.Open();
>         IDbCommand dbcmd = new SqlCommand("GetNtwkNEType",
> (SqlConnection)dbcon);
> 	dbcmd.CommandType = CommandType.StoredProcedure;
> 	IDataParameter param =
> ((SqlCommand)dbcmd).Parameters.Add("@AddrType", SqlDbType.TinyInt);
> 	param.Direction = ParameterDirection.Input;
> 	param.Value = 0;
>         DataTable dtNtwk = new DataTable("Network");
>         DbDataAdapter dbAdptr = new SqlDataAdapter((SqlCommand)dbcmd);
>         int iRows = dbAdptr.Fill(dtNtwk);
> 	Console.WriteLine ("Returned " + iRows + " rows");
>         dbcon.Close();
>         dbcon = null;
>     }
> }
> 
> 
> On Mon, Jul 12, 2004 at 08:40:05PM +0300, Igor Georgiev wrote:
> > anyone got DbDataAdapter.Fill Method work?
> > I need to deploy working .NET web application to apache/xsp/mono,
> > but unfortunately i always get an empty dataset :((
> > 
> > ExecuteScalar & ExecuteReader works for me,  so as a last resort
> > i'll rewrite the data access components to fill dataset by hand :(((
> > 
> > 
> > I think it's a bug so i submit a report,
> > but i'm very intersted does anyone get it work?
> > If yes pls notify me urgent because i have a deadline to do the work
> .
> > 
> > ----- here is the copy of my bug report ----
> > odbcDataAdapter.Fill(DataSet) doesn't work for me
> > 
> > Steps to reproduce the problem:
> > 1. create odbcDataAdapter that select something from database
> > 2. generate named/typed dataset /i'm using VS2003.NET /
> > 3. fill dataset
> > 
> > Actual Results:
> > dataset is empty
> > 
> > Expected Results:
> > Data in the dataset
> > 
> > How often does this happen? 
> > Always
> > 
> > Additional Information:
> > Code work fine in .NET framework
> > -----
> > also i try public int Fill( DataTable dataTable); - same result :(((
> > 
> > 
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.718 / Virus Database: 474 - Release Date: 09.07.2004
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com 
> > http://lists.ximian.com/mailman/listinfo/mono-list 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com 
> http://lists.ximian.com/mailman/listinfo/mono-list