Convert VB.NET to C#

Fermé
hanane - Modifié par hanane le 21/03/2011 à 15:05
1@@9 Messages postés 252 Date d'inscription lundi 6 octobre 2008 Statut Membre Dernière intervention 31 janvier 2016 - 27 mars 2011 à 21:42
Bonjour,


comment je vx declaree ce module vb.net en c sharp



Imports System.Data.SqlClient
Module declaration_global
Public con As New SqlConnection("Data Source=nananaFE237E976;Initial Catalog=gestion_formation;Integrated Security=True")
Public ds As New DataSet
Public da As SqlDataAdapter
Public dr As SqlDataReader
Public cmd As SqlCommand
Public Sub connect()
con.ConnectionString = "Data Source=nananaFE237E976;Initial Catalog=app;Integrated Security=True"
Try
con.Open()
Catch ex As Exception
MsgBox(ex.Message())
End Try
End Sub
Public Sub requet(ByVal a As String)
cmd.CommandText = a
cmd.CommandType = CommandType.Text
cmd.ExecuteNonQuery()
End Sub
End Module
A voir également:

1 réponse

1@@9 Messages postés 252 Date d'inscription lundi 6 octobre 2008 Statut Membre Dernière intervention 31 janvier 2016 27
27 mars 2011 à 21:42
Bonsoir

using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Data.SqlClient;
static class declaration_global
{
public static SqlConnection con = new SqlConnection("Data Source=nananaFE237E976;Initial Catalog=gestion_formation;Integrated Security=True");
public static DataSet ds = new DataSet();
public static SqlDataAdapter da;
public static SqlDataReader dr;
public static SqlCommand cmd;
public static void connect()
{
con.ConnectionString = "Data Source=nananaFE237E976;Initial Catalog=app;Integrated Security=True";
try {
con.Open();
} catch (Exception ex) {
Interaction.MsgBox(ex.Message());
}
}
public static void requet(string a)
{
cmd.CommandText = a;
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
}
Converted by sofianeDZ
0