Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

Reading rows in .NET Connector (no replies)

$
0
0
First of all, hello!
I have a little problem. As I am a beginner in .NET programming (now using C++/CLI) I stumbled upon a problem. I managed to connect to my database which contains rows and columns (Captain Obvious).
Let's say I have the column "iASpeed" with 92 values in it, so 92 rows. Basically I want the row from index 1 to go in iASpeed[0], the value from index 2 to go in iASpeed[1];, etc
So here is how I tried:
private: void GetChamps() {
			 MySqlConnection ^champs = gcnew MySqlConnection("Server=server;Database=database;Uid=user;Pwd=pwd;");
			 champs->Open();
			 int j = 0;
			 String ^Command = "SELECT iASpeed FROM Champions WHERE id = " + j;
			 MySqlCommand ^cmdSQL = gcnew MySqlCommand(Command, champs);
     		 MySqlDataReader ^myReader;
			 myReader = cmdSQL->ExecuteReader();
			 while(myReader->Read()) {
			 iASpeed[j] = myReader->GetDouble(iASpeed);
			 j++;
			 }
			 //cmdSQL->ExecuteNonQuery();
			 myReader->Close();
			 champs->Close();
		 }
Also, the iASpeed is defined:
static array <double>^ iASpeed = gcnew array<double>(92);

Any help is apreciated!
Thank you in advance!

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>