问题描述
遇见这种乱码问题求大神解决publicpartialclasstest:System.Web.UI.Page{privatereadonlystring_strConn="Server=192.168.0.107;Port=5432;UserId=postgres;Password=123;Database=TestDB;";protectedvoidPage_Load(objectsender,EventArgse){try{NpgsqlConnectionconn=newNpgsqlConnection(_strConn);conn.Open();stringsql="selectcount(*)fromTdb";NpgsqlCommandcmd=newNpgsqlCommand(sql,conn);intn=cmd.ExecuteNonQuery();conn.Close();if(n>0){Label1.Text="yes";}else{Label1.Text="no";}}catch(Exceptionex){Label1.Text=ex.Message;}}}
解决方案
时间: 2024-09-19 10:02:05