using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using System.Runtime.Remoting.Contexts;
namespace projet2
{
class Program
{
static void Main(string[] args)
{
try
{
string connectString = "database=dbdotnet;server=SWEET-2D8161F34/SQLEXPRESS;User ID=tester;pwd=tester";
SqlConnection connexion = new SqlConnection(connectString);
connexion.Open();
SqlCommand command = new SqlCommand("SELECT * FROM table1", connexion);
SqlDataReader reader = command.ExecuteReader();
Console.WriteLine(reader.GetString(1));
}
catch (Exception ex)
{
Console.WriteLine( ex.Message);
}
reader.close();
connexion.close();
}
}
}
les erreur:
Error 1 The name 'reader' does not exist in the current context
Error 2 The name 'connexion' does not exist in the current context
bon pouver vous me guider pour resoudre ce problème???