ASP.NET c# 调用数据库问题
在下是初学者,盼指教,CS代码如下:publicpartialclass_Default:System.Web.UI.Page{protectedvoidPage_Loa...
在下是初学者,盼指教,CS代码如下:
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MySqlConnection Conn = new MySqlConnection("DataSource=localhost;DataBase=ncs;UserID=root;Password=123456");
string strSQL = "SELECT * FROM cdb_attachments where aid=59146";
MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(strSQL, Conn);
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet);
MySQLDataGrid.DataSource = myDataSet;
MySQLDataGrid.DataBind();
string mystr;
//如上代码,查询到的表cdb_attachments中有几个列
//现在我想取查询到的这一条记录中一列“filetype”的数据
//并赋值给“mystr”,这里应该怎么写?
}
} 展开
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MySqlConnection Conn = new MySqlConnection("DataSource=localhost;DataBase=ncs;UserID=root;Password=123456");
string strSQL = "SELECT * FROM cdb_attachments where aid=59146";
MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(strSQL, Conn);
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet);
MySQLDataGrid.DataSource = myDataSet;
MySQLDataGrid.DataBind();
string mystr;
//如上代码,查询到的表cdb_attachments中有几个列
//现在我想取查询到的这一条记录中一列“filetype”的数据
//并赋值给“mystr”,这里应该怎么写?
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询