Learn socket programming. How to do that will depend on the operating system you are using. If *nix you need POSIX sockets. MS-Windows use WinSocket.
Ancient Dragon
Achieved Level 70
32,161 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69
Using what OS?
On windows, you can use C++/CLI and open a WebClient^ to a page.
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
It can be also easily done with C# and VB. But since this is c++ forum ...
Ancient Dragon
Achieved Level 70
32,161 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69
>>EDIT : My project is a Windows Form type.
That is not c++ -- its CLI/C++ which is slightly different language
>>This can be done more easly with the webBrowser1 from Tools ?
Probably.
Ancient Dragon
Achieved Level 70
32,161 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69
First thank you all for your reply.
EDIT : My project is a Windows Form type./QUOTE]
What are you going to DO with the contents of the web page when you get it?
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
I'm still confused.
Can you just use this->webBrowser1->DocumentText->ToString()->Split( /*parameters go here*/) ?
to convert that text into an array?
I still need to ask, are you just attempting to get some text from a page or do you actually need to start a browser object?
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
If you have not already downloaded the connector (for .net), you will need to get it:
http://www.mysql.com/downloads/connector/net/
Once you get that installed, you can add a reference to the MySql.Data DLL entry and add "using namespace MySql:: Data::MySqlClient;" to the code that will use it.
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
Ancient Dragon
Achieved Level 70
32,161 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,577
Skill Endorsements: 69
Don't include those headers.
There is documentation on the site.
...but here is a code snippet assuming you have a database table named "SOME_TABLE" that has a column called "NAME":
#include "stdafx.h"
using namespace System;
using namespace System::Collections::Generic;
using namespace System::IO;//assuming you still need this for the other part
using namespace System::Net; //assuming you still need this for the other part
using namespace MySql::Data::MySqlClient;
bool GetListFromDb(List<String^>^ lst_strNames, String^% strError)
{
bool blnRetVal = true;
try
{
MySqlConnectionStringBuilder^ csb = gcnew MySqlConnectionStringBuilder();
csb->Server = "{server address goes here}";
csb->Database = "{database name goes here}";
csb->UserID = "{user id goes here}";
csb->Password = "{password goes here}";
MySqlConnection^ conn = gcnew MySqlConnection(csb->ToString());
String^ strSQL = "SELECT NAME from SOME_TABLE";
MySqlDataReader^ rdr = (gcnew MySqlCommand(strSQL, conn))->ExecuteReader();
while(rdr->Read())
{
lst_strNames->Add(rdr["NAME"]->ToString()->Trim());
}
rdr->Close();
conn->Close();
}
catch(Exception^ exc)
{
blnRetVal = false;
strError = exc->Message;
}
return blnRetVal;
}
...and it can be called like this:
String^ strError = "";
List<String^>^ lst_strNames = gcnew List<String^>();
if(!GetListFromDb(lst_strNames, strError))
{
System::Diagnostics::Debug::WriteLine("Could not load list: " + strError);
return -1;
}
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
Check my edit (as I added the namespaces):
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7
What you're asking is how to convert a list of Strings to a single String.
I would do it like this:
using namespace System::Linq;
...
this->textBox4->Text =
String::Join("\n",
Enumerable::ToArray<String^>(lst_strNames));
thines01
Postaholic
2,433 posts since Oct 2009
Reputation Points: 447
Solved Threads: 408
Skill Endorsements: 7