Olá,
Sou iniciante em C# e estou com dúvidas em um código que estou acompanhando de um tutorial. Está acusando muitos erros inclusive de não reconhecer as strings declaradas(acho que tem haver com os locais declarados).
Segue o código caso alguém possa ajudar:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using Npgsql;
namespace CRUD_Posrgre
{
class DAL
{
static string serverName = "127.0.0.1"; //localhost
static string port = "5432"; // porta default
static string username = "postgres"; // nome do administrador
static string password = "senha"; // senha do administrador
static string database = "Cadastro"; // nome do banco de dados
NpgsqlConnection npgConnection = null;
public string stringConnection = null;
public DAL
{
stringConnection = "Server=" + serverName + ";Port=" + port + ";User id=" + username +
";Password=" + password + ";Database=" + database + ";");
}
}
}
Obrigado por qualquer ajuda.