Hi Cetin.
Once I have made connection, is it good practce in C# to 1) pass these connection to other functions (like in your example, can I pass variable cn and cmd to other functions) or 2) should I create more connections as I need them in my functions and close them as I finish.
BTW: I haven't tried the former yet... don't know if I can.
Thanks.
>Then use Ctrl+F5 otherwise console applications do not wait after outputting their results. ie:
>
>
>// Add these to top
>using System.Data;
>using System.Data.OleDb;
>
>
> static void Main()
> {
> string strConn = @"Provider=VFPOLEDB;Data source=
>C:\Program Files\Microsoft Visual FoxPro 9\Samples\Data\testdata.dbc;";
>
> string strQuery = "select * from customer where country = 'USA'";
>
> OleDbConnection cn = new OleDbConnection(strConn);
> cn.Open();
>
> OleDbCommand cmd = new OleDbCommand(strQuery,cn);
> OleDbDataReader rdr = cmd.ExecuteReader();
>
> while (rdr.Read())
> {
> Console.WriteLine("{0}, {1}, {2}",
> rdr["cust_id"],
> rdr["Company"],
> rdr["Contact"]);
> }
> rdr.Close();
> cn.Close();
> }
>
>Cetin
>
>
>>Hi Cetin.
>>I pressed F5 and it did "blink" like it was doing something, but no out put.
>>I'm trying to connect to a foxpro table and updating a row.
>>
>>And I even put
>>
>>
>>.
>>.
>>.
>>}
>>Console.WriteLine("Hello .NET World");
>>{
>>
>>
>>in my code to see if I can get any response... but no response yet.
>>
>>
>>>>>>greetings.
>>>>>>
>>>>>>Is there a way to compile a .NET program in the .NET interface (is the right term) rather then doing "csc MyProgram.cs" on the command line?
>>>>>>
>>>>>>TIA.
>>>>>
>>>>>Sam,
>>>>>
>>>>>Do you have Visual Studio .NET or Visual C# Express installed on your PC?
>>>>
>>>>
>>>>I'm at home and all I have right now is Express.
>>>>I'm expecting the 2005 Professional "Academic" edition next week.
>>>>
>>>>thanks
>>>
>>>Doesn't matter really. F5 would compile and run. Or build (doesn't express menu have it?).
>>>Cetin
The American Republic will endure, until politicians realize they can bribe the people with their own money.
- Alexis de Tocqueville
No man’s life, liberty, or property is safe while the legislature is in session.
– Mark Twain (1866)