Rahman Jalayer Rahman Jalayer - 1 year ago 108
Vb.net Question

How to use sqlparameter in vb.net

i have some codes in c# and want to convert to vb.net:

codes in c#:

public Dataset ExecuteDataset(CommandType commandType, string commandText, SqlParameter[] commandParameters)

public DataSet ShowList()
DataSet ds = new DataSet();

ds = e.ExecuteDataset(CommandType.StoredProcedure, "PrcShowList", new SqlParameter[] ({new SqlParameter("@Id",Id) });

return ds;


how to convert this code to vb.net. i am new in vb.net

Answer Source

I use this free online tool for conversion. http://converter.telerik.com/

Which gives:

Public Function ExecuteDataset(commandType As CommandType, commandText As String, commandParameters As SqlParameter()) As Dataset

End Function

Public Function ShowList() As DataSet
    Dim ds As New DataSet()

    ds = e.ExecuteDataset(CommandType.StoredProcedure, "PrcShowList", New SqlParameter() {New SqlParameter("@Id", Id)})

    Return ds
End Function

'Service provided by Telerik (www.telerik.com)
'Conversion powered by NRefactory.
'Twitter: @telerik
'Facebook: facebook.com/telerik

Although i did have to fix a small typo first where the parameter array was created

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download