Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locking VFP records in ASP.NET
Message
 
 
À
17/09/2008 14:24:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01348296
Message ID:
01348366
Vues:
22
Wow, congrats! Can you post your VFP SP as well?

>Ok, I figured out how to get the value back from a VFP stored procedure.
>
>
>
>    protected Int32 VFPGetNextID(String tablename)
>    {
>        String strCmd = "GetNextID('" + tablename.Trim().ToUpper() + "')";
>        Int32 retval = 0;
>        OleDbConnection myconn = new OleDbConnection(@"Provider=VFPOLEDB.1;Data Source=\\path\dbccontainer.DBC");
>        myconn.Open();
>        OleDbCommand cmd = new OleDbCommand(strCmd, myconn);
>        OleDbDataReader reader = cmd.ExecuteReader();
>        if (reader.Read())
>        {
>            retval = System.Convert.ToInt32(reader.GetValue(0));
>        }
>        reader.Close();
>        myconn.Close();
>       
>        return retval;
>    }
>
>
>
>
>
>Thanks for the help! One more roadblock down!
>
>
>
>>>>Great question. I believe it was asked here two times and no solution was found how to retrieve output parameter from SP called by OleDB in .NET
>>>
>>>Why would you need an output parameter?
>>>
>>
>>You need to get the ID back once you created a new record. In SQL Server it's SCOPE_IDENTITY(), but I remember few threads here (I think you participated in one of them) to get the ID (or output parameter) back from VFP SP. Don't recall good solution, but I can quickly find these threads again.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform