Click here to Skip to main content
15,914,322 members
Home / Discussions / C#
   

C#

 
AnswerRe: Getting todays date Pin
Guffa31-Jan-08 3:35
Guffa31-Jan-08 3:35 
GeneralRe: Getting todays date Pin
PIEBALDconsult31-Jan-08 8:05
mvePIEBALDconsult31-Jan-08 8:05 
Generalxml and lable Pin
samidhas30-Jan-08 22:25
samidhas30-Jan-08 22:25 
QuestionHow to get processes even if their name changed? Pin
spearwall30-Jan-08 22:17
spearwall30-Jan-08 22:17 
AnswerRe: How to get processes even if their name changed? Pin
mav.northwind30-Jan-08 23:40
mav.northwind30-Jan-08 23:40 
AnswerRe: How to get processes even if their name changed? Pin
CPallini30-Jan-08 23:46
mveCPallini30-Jan-08 23:46 
GeneralRe: How to get processes even if their name changed? Pin
Luc Pattyn31-Jan-08 1:34
sitebuilderLuc Pattyn31-Jan-08 1:34 
GeneralRe: How to get processes even if their name changed? Pin
CPallini31-Jan-08 2:15
mveCPallini31-Jan-08 2:15 
GeneralRe: How to get processes even if their name changed? Pin
Luc Pattyn31-Jan-08 2:34
sitebuilderLuc Pattyn31-Jan-08 2:34 
GeneralOK, 241270 013 27 Pin
CPallini31-Jan-08 2:48
mveCPallini31-Jan-08 2:48 
GeneralRe: How to get processes even if their name changed? Pin
spearwall31-Jan-08 4:16
spearwall31-Jan-08 4:16 
GeneralRe: How to get processes even if their name changed? Pin
Luc Pattyn31-Jan-08 5:19
sitebuilderLuc Pattyn31-Jan-08 5:19 
GeneralRe: How to get processes even if their name changed? [modified] Pin
spearwall31-Jan-08 17:12
spearwall31-Jan-08 17:12 
GeneralRe: How to get processes even if their name changed? Pin
Luc Pattyn31-Jan-08 22:22
sitebuilderLuc Pattyn31-Jan-08 22:22 
GeneralRe-initialization of the graph Pin
B!Z30-Jan-08 21:28
B!Z30-Jan-08 21:28 
GeneralRe: Re-initialization of the graph Pin
pmarfleet30-Jan-08 21:45
pmarfleet30-Jan-08 21:45 
GeneralPage reloaded when ContentType = "Application/vnd.msword" [modified] Pin
JohnAneston30-Jan-08 20:41
JohnAneston30-Jan-08 20:41 
Questionhow to display the tree nodes and its atrributes in the list format in multiline textbox Pin
samidhas30-Jan-08 20:28
samidhas30-Jan-08 20:28 
GeneralCreating Custom Emails from C# code Pin
SB 30-Jan-08 20:03
SB 30-Jan-08 20:03 
GeneralRe: Creating Custom Emails from C# code Pin
Ed.Poore30-Jan-08 23:00
Ed.Poore30-Jan-08 23:00 
GeneralRegarding certification.... Pin
tasumisra30-Jan-08 19:01
tasumisra30-Jan-08 19:01 
GeneralWrong forum Pin
pmarfleet30-Jan-08 21:47
pmarfleet30-Jan-08 21:47 
GeneralConnecting C#.Net to SQL Server 2000 Pin
klaydze30-Jan-08 17:31
klaydze30-Jan-08 17:31 
hi, i am a vb.net user and i want to try to convert my vb.net program to C#.Net. i have a class (clsDataAccess) where i execute my query. i'd try it to convert it to C#.Net but it gives me a lot of errors. i want to use this clsDataAccess as my default class when executing my query. can you pls help me to convert it. below is my code.

Imports System<br />
Imports System.Data<br />
Imports System.Data.SqlClient<br />
Imports AddressBook.usermod1<br />
<br />
Public Class clsDataAccess<br />
<br />
    Public objConnection As SqlConnection<br />
    Public objTransaction As SqlTransaction<br />
<br />
    Public Function SqlConnect() As Boolean<br />
<br />
        Try<br />
            objConnection = New SqlConnection<br />
            'objConnection.ConnectionString = "Server=(local);database=AddressBook;user id=sa;password=;"<br />
            objConnection.ConnectionString = "Server=" & GetServer("\conn.cfg") & "; DataBase=" & GetDatabase("\conn.cfg") & "; User ID =" & GetUser("\conn.cfg") & "; Integrated Security=false"<br />
<br />
            If objConnection.State = ConnectionState.Closed Then _<br />
                objConnection.Open()<br />
<br />
            Return True<br />
<br />
        Catch ex As Exception<br />
<br />
            MsgBox("Failed to connect to data source.", MsgBoxStyle.Information, "")<br />
            Return False<br />
<br />
        Finally<br />
            objConnection.Close()<br />
<br />
        End Try<br />
<br />
    End Function<br />
<br />
    Public Function ExecuteQuery(ByVal strSQL As String) As DataTable<br />
        Dim objDataTable As DataTable<br />
        Dim objDataAdapter As SqlDataAdapter<br />
<br />
        Try<br />
<br />
            SqlConnect()<br />
            objDataAdapter = New SqlDataAdapter<br />
<br />
            With objDataAdapter<br />
<br />
                objDataTable = New DataTable<br />
                .SelectCommand() = New SqlCommand(strSQL, objConnection, objTransaction)<br />
                .Fill(objDataTable)<br />
<br />
                Return objDataTable<br />
<br />
            End With<br />
<br />
        Catch sqlex As Exception<br />
            Throw sqlex<br />
<br />
        Catch ex As Runtime.InteropServices.COMException<br />
            Throw ex<br />
        Finally<br />
            objDataAdapter = Nothing<br />
<br />
        End Try<br />
    End Function<br />
<br />
    Public Sub ExecuteNonQuery(ByVal strSQL As String)<br />
        Dim objSqlCommand As SqlCommand<br />
<br />
        Try<br />
            SqlConnect()<br />
            objSqlCommand = New SqlCommand(strSQL, objConnection)<br />
            objSqlCommand.Connection.Open()<br />
            objSqlCommand.ExecuteNonQuery()<br />
<br />
        Catch ex As SqlException<br />
            Throw ex<br />
<br />
        Catch ex As Runtime.InteropServices.COMException<br />
            Throw ex<br />
<br />
        Finally<br />
            objSqlCommand = Nothing<br />
<br />
        End Try<br />
    End Sub<br />
<br />
    Public Function ExecuteNonQuery(ByVal strSQL As String, ByVal sqlparams As SqlParameter()) As Boolean<br />
<br />
        Try<br />
            Dim intindex As Integer<br />
            Dim objsqlcommand As New SqlCommand(strSQL, objConnection, objTransaction)<br />
<br />
            For intindex = 0 To UBound(sqlparams)<br />
                objsqlcommand.Parameters.Add(sqlparams(intindex))<br />
            Next<br />
<br />
            objsqlcommand.ExecuteNonQuery()<br />
            Return True<br />
<br />
        Catch ex As Exception<br />
<br />
            Throw ex<br />
<br />
        End Try<br />
    End Function<br />
End Class


Thank You.

Don't block the drive way of all the newbies in programming. Smile | :)

GeneralRe: Connecting C#.Net to SQL Server 2000 Pin
Rocky#30-Jan-08 20:19
Rocky#30-Jan-08 20:19 
GeneralRe: Connecting C#.Net to SQL Server 2000 Pin
Ashfield31-Jan-08 0:06
Ashfield31-Jan-08 0:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.