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.C ount > 0 Then
catId = myDataSet.Tables(0).Rows(0 )("ID").To String()
End If
Dim myDataSet As DataSet = Nothing
myDataSet = GKCAccount.GetServerID(3)
If myDataSet IsNot Nothing AndAlso myDataSet.Tables.Count > 0 AndAlso myDataSet.Tables(0).Rows.C
catId = myDataSet.Tables(0).Rows(0
End If
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();
}
http://www.developerfusion.com/tools/convert/vb-to-csharp/
Ignore my post. It is already answered.
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.C ount > 0 && (myDataSet.Tables[0].Rows[ 0]["Server "].ToStrin g() = "Admin"))
Please correct my code.
Thanks,
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.C
Please correct my code.
Thanks,
Change
= "Admin"
to
== "Admin"
= "Admin"
to
== "Admin"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much. It is the right solution!
Glad I could help
Raj
Raj
You said his solution is better for you.
LOOK again at his solution and mine.
NO difference.
LOOK again at his solution and mine.
NO difference.
myDataSet = GKCAccount.GetServerID(3);
if (myDataSet != null && myDataSet.Tables.Count > 0 && myDataSet.Tables(0).Rows.C
catId = myDataSet.Tables(0).Rows(0
}
You can use this tool to do it yourself:
http://converter.telerik.com/