Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在c.net中使用mysqldatareader将MySQL数据库转换为组合框_C#_Mysql_Sql_.net - Fatal编程技术网

C# 在c.net中使用mysqldatareader将MySQL数据库转换为组合框

C# 在c.net中使用mysqldatareader将MySQL数据库转换为组合框,c#,mysql,sql,.net,C#,Mysql,Sql,.net,在c.net中使用mysqldatareader将MySQL数据库转换为组合框 MySqlCommand cmd = new MySqlCommand("select * from product", connection); MySqlDataReader dread = cmd.ExecuteReader(); while (dread.Read()) { } 使用mysqldatareader而不是mysqldataadapter。哇。。。 Suppost您的combox名称是cbPro

在c.net中使用mysqldatareader将MySQL数据库转换为组合框

MySqlCommand cmd = new MySqlCommand("select * from product", connection);
MySqlDataReader dread = cmd.ExecuteReader();
while (dread.Read())
{
}
使用mysqldatareader而不是mysqldataadapter。

哇。。。 Suppost您的combox名称是cbProducts,您希望用查询的列描述填充它

MySQL database to combo box using mysqldatareader in c#.net

MySqlCommand cmd = new MySqlCommand("select * from product", connection);
MySqlDataReader dread = cmd.ExecuteReader();
while (dread.Read())
{
    cbProducts.Items.Add(dread("description");
}

你的问题是什么?这是字面意义上的“为我做”几乎没有信息。1.我们不是来为你做工作的,我们是出于自己的选择来帮助回答问题2的。你能提供更多关于你真正想要达到的目标的信息吗?你在使用ASP吗?您想为组合框生成HTML源代码吗?我投票将此问题作为非主题关闭,因为它是家庭作业。此代码使用SqlDataAdapter,我想使用sqlDataReader字符串查询=选择震源组名称,震源组ID;SqlDataAdapter da=新的SqlDataAdapterquery,conn;康涅狄格开放大学;数据集ds=新数据集;陆军部,菲尔兹,舰队;cmbTripName.DisplayMember=车队名称;cmbTripName.ValueMember=FleetID;cmbTripName.DataSource=ds.Tables[Fleet];这段代码是使用SqlDataAdapter的,我想用sqlDataReaderFix来解决这个问题。有很多关于如何使用DataReader的示例。你尝试了什么?你在最后一行代码中得到了一个无与伦比的,恐惧是一个对象,而不是一个方法。