Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored procedure for edit log
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01361756
Message ID:
01363021
Views:
11
>Hi,
>
>Sorry - missed this message. Don't use Update command. Here's an example that you should be able to adapt. VFP SPs:
PROCEDURE SetUserName
>LPARAMETERS cUserName
>PUBLIC UserName
>UserName = cUserName
>ENDPROC
>
>FUNCTION WhoIsCurrentUser
>  RETURN UserName
>ENDFUNC
>
>.NET test code:
       static void Main(string[] args)
>        {
>            //Set public variable when setting up the connection
>            System.Data.OleDb.OleDbConnection myConn = ConnectionProvider.CreateConnectionForUser("Jim");
>
>            // Now see if the public variable is accessible by SP
>            System.Data.OleDb.OleDbCommand test = new System.Data.OleDb.OleDbCommand();
>            test.Connection = myConn;
>            test.CommandText = "WhoIsCurrentUser()";
>            string s = (string) test.ExecuteScalar();
>        }
>    }
>
>
>    static class ConnectionProvider
>    {
>        static public System.Data.OleDb.OleDbConnection CreateConnectionForUser(string sUser)
>        {
>            string connection = "Provider=VFPOLEDB.1;Data Source=Data1.dbc";
>            System.Data.OleDb.OleDbConnection oledb = new System.Data.OleDb.OleDbConnection(connection);
>            oledb.Open();
>
>            System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand();
>            command.Connection = oledb;
>            command.CommandText = "SetUserName('" + sUser + "')";
>            command.ExecuteNonQuery();
>             return oledb;
>        }
>    }
>
>HTH,
>Viv

Hi Viv,

I don't think this

command.CommandText = "SetUserName('" + sUser + "')";

is going to work.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform