Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 17th, 2004, 12:41 PM
eheemsk eheemsk is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 eheemsk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Strange problem on FbDataAdapter.Fill after calling a stored procedure (net provider)

Hello everybody,

I'm fairly new to the world of firebird and asp.net. On www.dotnetjunkies.com I found an article on calling (testing) stored procedures from an asp.net application. I thought it nice exercise to try to adapt the code given there, to use firebird and the .net provider.

Obtaining the stored procedures and their parameters from a database went pretty straightforward. But then executing them was a problem. I use a procedure to add parameters to an FbCommand.

If I use:
Code:
void AddParameters(FbCommand ACommand)
{
        ACommand.Parameters.Add("@UPWD", FbDbType.VarChar).Direction = ParameterDirection.Input; 
        ACommand.Parameters["@UPWD"].Value = (dgParameters.Items[0].Controls[5].Controls[1] as TextBox).Text.ToString();
        ACommand.Parameters.Add("@UNAME", FbDbType.VarChar).Direction = ParameterDirection.Input; 
        ACommand.Parameters["@UNAME"].Value = (dgParameters.Items[1].Controls[5].Controls[1] as TextBox).Text.ToString();
}


on 1 specific stored proc (sp_web_login) everything works just fine, and the results are what I expect them to be. But when I try to make it as flexible as I want it to be and use:
Code:
    String CreateParameterName(DataGridItem Adi)
    {
        return "@" + (Adi.Controls[0] as TableCell).Text.ToString();
    }
    
    String GetDGValueString(DataGridItem Adi)
    {
        return (Adi.Controls[5].Controls[1] as TextBox).Text.ToString();
    }
        
    void AddParameters(FbCommand ACommand)
    {
        int index;
        DataGridItem di;
        lbParametersLoaded.Items.Add(dgParameters.Items.Count.ToString());
        
        for (index = 0; index < dgParameters.Items.Count; index++)
        {
            di = dgParameters.Items[index];
            if ( (di.Controls[4] as TableCell).Text.ToString() == "0")
            {
                switch ((di.Controls[1] as TableCell).Text.ToString())
                {
                    case "37" : //just varchar at the moment
                        ACommand.Parameters.Add(CreateParameterName(di), FbDbType.VarChar).Direction = ParameterDirection.Input; 
                        ACommand.Parameters[CreateParameterName(di)].Value = GetDGValueString(di);
                        
                        lbParametersLoaded.Items.Add("Varchar added " + CreateParameterName(di) + "Value " + GetDGValueString(di));
                        break;
                    default:
                        lbParametersLoaded.Items.Add("Default " + (di.Controls[1] as TableCell).Text.ToString());
                        break;
                }
            }
        }
    }


After a call to addParameters(myCommand) and creating a new FbDataAdapter adpt. The call
adpt.Fill(ds, "Results");
gives an error.

As I can see it all the parameters are set in the same way, with the same name. Only in the second call the names are found in a datagrid.

I use the latest net-provider. All the files I use in this project can be found on:
source.zip

I hope someone can shine a light on this problem, and thanks for taking the time to read this much text

Reply With Quote
  #2  
Old February 18th, 2004, 12:43 PM
mariuz's Avatar
mariuz mariuz is offline
Bug Hunter
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Transylvania (Romania)
Posts: 309 mariuz User rank is Sergeant (500 - 2000 Reputation Level)mariuz User rank is Sergeant (500 - 2000 Reputation Level)mariuz User rank is Sergeant (500 - 2000 Reputation Level)mariuz User rank is Sergeant (500 - 2000 Reputation Level)mariuz User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Day 9 h 38 m 4 sec
Reputation Power: 22
Lightbulb take a look on this thread

http://forums.devshed.com/t65095/s.html

i will take look on the code later
Ps: there is a list for .net provider
http://sourceforge.net/mailarchive/...?forum_id=12591
and on the left corner is a search box
__________________
My home page: http://www.firebirdsql.org and work place :http://www.reea.net

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > Strange problem on FbDataAdapter.Fill after calling a stored procedure (net provider)

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap