[Solved] NpgsqlDataAdapter fill error: table does not exist in ASP.Net

sureshMGR
 
on Oct 29, 2021 02:13 AM
437 Views

Hello friends, i need to retrive table data from postgre sql in postgre below query works fine

SELECT * from SmtpCredentials where ID=1

but in front end c# code i received issue as this table does not exist

try
{
    NpgsqlConnection pgCon = new NpgsqlConnection(connection);
    pgCon.Open();
    NpgsqlCommand cmd = new NpgsqlCommand();
    cmd.Connection = pgCon;
    cmd.CommandText = ("SELECT * from SmtpCredentials where ID=1");
    cmd.CommandType = CommandType.Text;
    NpgsqlDataAdapter da = new NpgsqlDataAdapter(cmd);
    cmd.ExecuteNonQuery();
    cmd.Dispose();
    pgCon.Close();
}
catch(Exception ex)
{
 
}

please help

Download FREE API for Word, Excel and PDF in ASP.Net: Download