hello i had created a Vb.Net Class named Database
I want to make the same class for C# but i am little bit unfamiliar with the syntax can any of the People Convert the below code for C#
Help me Please!!!!!!!!!
I want to make the same class for C# but i am little bit unfamiliar with the syntax can any of the People Convert the below code for C#
Code:
Public Class Database
Private Shared mycommand As SqlCommand
Private Shared dr As SqlDataReader
Private Shared da As SqlDataAdapter
Private Shared con As SqlConnection
Shared Function connection()
Dim con As SqlConnection = New SqlConnection
con.ConnectionString = "data source = (local) ; initial catalog = WisHRM ; Integrated Security = SSPI"
Return con
End Function
Shared Sub GetSelectQuery(ByVal query As String)
con = Database.connection
con.Open()
mycommand = New SqlCommand(query, con)
dr = mycommand.ExecuteReader
dr.Read()
End Sub
Shared Function GetResult()
Return dr
End Function
Shared Sub GetDsQuery(ByVal query As String)
con = Database.connection
con.Open()
da = New SqlDataAdapter(query, con)
End Sub
Shared Function GetDsResult()
Return da
End Function
Shared Function GetUpdateQuery(ByVal query As String)
con = Database.connection
con.Open()
Dim i As Integer = 0
mycommand = New SqlCommand(query, con)
i = mycommand.ExecuteNonQuery
Return i
End Function
End Class
Comment