Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
code written in VB is :-

VB
Dim MaxItemID As Integer
 Dim objCMD As New MySqlCommand(StrSql, objConn)

 MaxItemID = IIf(IsDBNull(objCMD.ExecuteScalar()), 0, objCMD.ExecuteScalar()) + 1


then whats the code for C# ?
Posted
Updated 29-Sep-12 0:30am
v2

Hi,
Please find the code below
C#
int MaxItemID = 0;
SqlCommand objCMD = new SqlCommand(StrSql, objConn);
MaxItemID = (int)(objCMD.ExecuteScalar())+1;


Regarsd,
Ahmed Mandour
 
Share this answer
 
v2
For these types of problems, I suggest you one of the free available VB.NET to C# converters:
http://converter.telerik.com/[^]
http://www.carlosag.net/tools/codetranslator/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900