Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locking VFP records in ASP.NET
Message
 
 
To
17/09/2008 14:24:41
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01348296
Message ID:
01348366
Views:
20
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
Previous
Reply
Map
View

Click here to load this message in the networking platform