Khan Baba

Khan Baba

  • NA
  • 26
  • 4.7k

VB6 code convert into C#

Aug 12 2017 3:37 AM
Good day Guys,

I have VB6 Library and Windows Based Application i just want to convert it into C# Language and on C# language i am quite New i just created the SQL Connection string
but if i want to get data in VB6 i use ADOB.Recordset and i use function like this


//VB6 Code for getting MAXID from DATABASE


Public function MaxID(ColName as String, Table as String) as long
Dim recset as ADOB.Recordset
set recset =Conec.Execute("Select max(" & Colname & ")+1 as maxno from " & table

if Not recset.EOF Then
MaxID= iif(isNull(recset ! maxNo), 1 , recset ! maxNo)
Else
MaxID = 1

End If
Set recset= Nothing
End Function
 
 and now i just need that how to convert above VB6 code in C# and one more question that in VB6 we can add Modules where i can save all my Public functions for all forms and in C# how can we use one main file like VB6 help me guys
 
 
 Thanks in Advance
 

Answers (4)