Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stored procedure for edit log
Message
 
 
À
19/11/2008 15:45:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro et .NET
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01361756
Message ID:
01363021
Vues:
10
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform