473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Conerting Vb.NEt Code in Equalent c# code!

Vkas
78
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#

Expand|Select|Wrap|Line Numbers
  1. Public Class Database
  2.     Private Shared mycommand As SqlCommand
  3.     Private Shared dr As SqlDataReader
  4.     Private Shared da As SqlDataAdapter
  5.     Private Shared con As SqlConnection
  6.     Shared Function connection()
  7.         Dim con As SqlConnection = New SqlConnection
  8.         con.ConnectionString = "data source = (local) ; initial catalog = WisHRM ; Integrated Security = SSPI"
  9.         Return con
  10.     End Function
  11.     Shared Sub GetSelectQuery(ByVal query As String)
  12.         con = Database.connection
  13.         con.Open()
  14.         mycommand = New SqlCommand(query, con)
  15.         dr = mycommand.ExecuteReader
  16.         dr.Read()
  17.     End Sub
  18.     Shared Function GetResult()
  19.         Return dr
  20.     End Function
  21.     Shared Sub GetDsQuery(ByVal query As String)
  22.         con = Database.connection
  23.         con.Open()
  24.         da = New SqlDataAdapter(query, con)
  25.     End Sub
  26.     Shared Function GetDsResult()
  27.         Return da
  28.     End Function
  29.     Shared Function GetUpdateQuery(ByVal query As String)
  30.         con = Database.connection
  31.         con.Open()
  32.         Dim i As Integer = 0
  33.         mycommand = New SqlCommand(query, con)
  34.         i = mycommand.ExecuteNonQuery
  35.         Return i
  36.     End Function
  37.  
  38. End Class
  39.  
  40.  
Help me Please!!!!!!!!!
Apr 6 '10 #1
3 1347
GaryTexmo
1,501 Expert 1GB
It wouldn't do you any good to have someone convert the code for you... you'll get far more out of it if you do it yourself. The plus side here is that .NET programs in VB, C#, and C++ convert between each other very nicely! Also, looking at the code you posted, you don't have too much to convert.

Here's a link to a tutorial I found on google, it should get you started.
http://www.softsteel.co.uk/tutorials/cSharp/cIndex.html

Dive in and if you have troubles, post here and we can help you debug your conversion.
Apr 6 '10 #2
Vkas
78
ok thanks for the idea you mean to say i must have to attempt it by myself

ok
Apr 7 '10 #3
MrMancunian
569 Expert 512MB
Try it yourself first, otherwise, use the .Net Reflector. You can download it at the Microsoft download site...

Steven
Apr 7 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Jeroen | last post by:
Hi, I'm searching but not finding :( I need the code that creates automatic the days in a month So like for this month, it creates the days in this format 01-Oct, 02-Oct, .... This...
18
by: Phill Long | last post by:
this is the the code, now here is the final result.... I get one combo box and one tex box come up, but they are empty... DAMN!!! Any ideas on what Im doing wrong please.. Thanks Again <?php...
12
by: lawrence | last post by:
I have a string which I want to send to eval(). How can I test it ahead of time to make sure it is valid code? I don't want to send it to eval and get parse errors. I want to do something like...
51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
22
by: Harold Crump | last post by:
Greetings, I have a PHP/MySQL application that I am deploying at a client's. I am fairly certain that they will steal my source code and re-sell to other companies. I would like to somehow...
9
by: bigoxygen | last post by:
Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing...
3
by: Arvie | last post by:
I need some advice guys.. I am proposing that we get someone to do a complete audit/review of our Java application codebase, about 1000 JSPs/Servlets and 100 EJBs. If I get firms to submit...
4
by: Michael Chermside | last post by:
Will Stuyvesant writes: > If you know that your source code is going to be used > later by others, then I feel that code with the pattern: > > if some_condition: > some_name =...
5
by: vighnesh | last post by:
Hi Folks Greetings to you all. I am dealing with a project ( windows application ) in which I have to read the REG_BINARY value from the Registry and get its string equalent ( the ASCII text...
0
by: sureshbabu640 | last post by:
Hi I am devloping one exiting vb project into vb.net.In vb project i seen checkbox events like got focus and lose focus but i did not find in vb.net. Now can any...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.