Link to home
Start Free TrialLog in
Avatar of Takeoutdinner
Takeoutdinner

asked on

Convert VB.NET to C#

Please convert following VB.NET codes to C#:

                Dim myDataSet As DataSet = Nothing
                myDataSet = GKCAccount.GetServerID(3)
                If myDataSet IsNot Nothing AndAlso myDataSet.Tables.Count > 0 AndAlso myDataSet.Tables(0).Rows.Count > 0 Then
                    catId = myDataSet.Tables(0).Rows(0)("ID").ToString()
                End If
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

DataSet myDataSet = null;
myDataSet = GKCAccount.GetServerID(3);
if (myDataSet != null && myDataSet.Tables.Count > 0 && myDataSet.Tables(0).Rows.Count > 0) {
      catId = myDataSet.Tables(0).Rows(0)("ID").ToString();
}

You can use this tool to do it yourself:

http://converter.telerik.com/
DataSet myDataSet = null;
myDataSet = GKCAccount.GetServerID(3);
if (myDataSet != null && myDataSet.Tables.Count > 0 && myDataSet.Tables[0].Rows.Count > 0) {
	catId = myDataSet.Tables[0].Rows[0]["ID"].ToString();
}

Open in new window

http://www.developerfusion.com/tools/convert/vb-to-csharp/
Ignore my post. It is already answered.
Avatar of Takeoutdinner
Takeoutdinner

ASKER

Hi,
I had this question with telerik, so RajkumarGS's advice is better for me.
But I still have a problem it with:
            DataSet myDataSet = null;
myDataSet = Reports.GetServerByID(3);
if (myDataSet != null && myDataSet.Tables.Count > 0 && myDataSet.Tables[0].Rows.Count > 0 && (myDataSet.Tables[0].Rows[0]["Server"].ToString() = "Admin"))

Please correct my code.

Thanks,
Change
= "Admin"
to
== "Admin"

ASKER CERTIFIED SOLUTION
Avatar of Rajkumar Gs
Rajkumar Gs
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so much. It is the right solution!
Glad I could help
Raj
You said his solution is better for you.

LOOK again at his solution and mine.

NO difference.