OK, I solved the problem (it must have been way too late last night!).
#1 Here's the string that worked for me:
string l_command = "Select * from csrcli where upper(loginname) = ? and upper(password) = ?";
The problem was mixed case in my data table vs. what I was passing and I forgot to add the upper method on the where clause to address the issue.
#2 - As a side note, Cetin, you are correct; it doesn't appear to matter what you name the parameter in the addvalue statement. I took out the ?, @, and just left the name, and it works just fine. So, the first value is truly just for developer clarity as far as I can tell.
Thanks to you both for helping me work this out....I may be able to finish this project yet!!!!!
The problem was case related. I was passing the parameter values in all caps and my table had mixed case information in it. What I would like to do is pass the following SQL string:
Select * from csrcli where loginname = upper(?) and password = upper(?);
>>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
Steve Howie, owner
DaSH Technology
Denver, CO