Need help converting code.
Ok so this is my first time learning c++ and ive been teaching myself for 2 days. Im in the process of converting an application i made in vb.net to c++ but i am stuck at a point and i cannot understand why for the life of me it is happening.
Im currently converting this block:
to:
I have underlined the line of code thats giving me a headache. Looking at my code i have written everything correctly so why won't it work? I have tried multiple solutions but none work, i either get one of the following errors:
1>.\AU.cpp(47) : error C2227: left of '->Contains' must point to class/struct/union/generic type
or
*1>.\AU.cpp(47) : error C2064: term does not evaluate to a function taking 1 arguments
Help!
Im currently converting this block:
Code:
Dim con As OleDb.OleDbConnection = New _
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " & _
Server & "\Database.mdb")
con.Open()
Dim cmd As OleDb.OleDbCommand = New _
OleDb.OleDbCommand(str, con)
Dim da As New OleDb.OleDbDataAdapter(cmd)
Dim ds As New DataSet()
da.Fill(ds, "DatabaseName")
Dim dr As DataRow
For Each dr In ds.Tables(0).Rows
If dr(1).ToString.Contains(arg(1)) Then
Else
Console.WriteLine("")
Exit For
End If
Next
Code:
using namespace System::Data::OleDb;
OleDbConnection ^ myConnection = gcnew OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source = "+ server + "\\Database.mdb");
try{
//Open Connection
myConnection->Open();
OleDbCommand ^ cmd = gcnew OleDbCommand(str, myConnection);
OleDbDataAdapter ^ adapter = gcnew OleDbDataAdapter(cmd);
DataSet ^ ds = gcnew DataSet();
adapter->Fill(ds,"DatabaseName");
DataRow ^ dr;
for each(dr in ds->Tables[0]->Rows){
if (dr[1]->ToString->Contains(argv[1])){
}
}
}catch(OleDbException ^ ex){
Console::WriteLine(ex->Message);
system("PAUSE");
}
1>.\AU.cpp(47) : error C2227: left of '->Contains' must point to class/struct/union/generic type
or
*1>.\AU.cpp(47) : error C2064: term does not evaluate to a function taking 1 arguments
Help!

so you need those in there
