Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# 2005 and VFPOLE with parameters
Message
De
03/12/2005 11:43:23
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 2.0
Database:
Visual FoxPro
Divers
Thread ID:
01074551
Message ID:
01074595
Vues:
10
>I am trying to do a simple query from a VFP table into C# using a VFPOLE connection. I can get the table to pull over completely into a DataAdapter without any parameters, but as soon as I introduce parameters, I get 0 records (and I know there should be at least one). This has to be a rather simple problem; can anyone steer me in the right direction?
>
>
>        string pTable = "csrcli.dbf";
>	string pSQLcommand = "Select * from csrcli where loginname = ? and password = ?";
>
>        OleDbConnection VFP7Connection = new OleDbConnection();
>        string l_conn = "provider=VFPOLEDB.1;DATA SOURCE=" + Server.MapPath("csr.dbc") +
>               ";Exclusive=NO;Backgroundfetch=NO";
>	VFP7Connection.ConnectionString = l_conn;
>
>		
>	//build command object to pass through connection
>	string strSelect = pSQLcommand;
>	//OleDbCommand VFP7SelectCommand;
>	OleDbCommand VFP7SelectCommand = new OleDbCommand();
>	VFP7SelectCommand.CommandText = strSelect;
>	VFP7SelectCommand.Parameters.AddWithValue("?mylogin",pLoginName);
>	VFP7SelectCommand.Parameters.AddWithValue("?mypass", pPassword);
>
>	VFP7Connection.Open();
>
>	//create a DataAdapter
>	OleDbDataAdapter VFP7DataAdapter = new OleDbDataAdapter();
>	VFP7DataAdapter.SelectCommand = VFP7SelectCommand;
>	VFP7DataAdapter.SelectCommand.Connection = VFP7Connection;
>		
>	//create the dataset
>	DataSet VFP7DataSet = new DataSet();
>	//fill the dataset (finally!)
>	VFP7DataAdapter.Fill(VFP7DataSet,pTable);
>	return VFP7DataSet;
>
>
>This simple task has wasted a whole day of research, trial & error. I would be most grateful if someone could help me get past this problem!!!!!
>
>Thanks!

Re: Using OleDbParameters and FOXPRO MEMO Fields Thread #1026872 Message #1026953
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform