不是计算机专家 - 需要帮助列表框 [英] NOT A COMPUTER EXPERT - NEED HELP IN listbox

查看:55
本文介绍了不是计算机专家 - 需要帮助列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个研究项目。我在单列(multiplr行)中有100s的文本值,如s1,s2,s2,s4等。现在我想将这些值保存在数据库中。



I am doing a research project. I have text values like s1, s2, s2, s4 etc in 100s in single column (multiplr rows). Now i want to save these values in a database.

foreach (ListViewItem item in listBox2.Items)
            try
            {
                
               SqlCommand cmd =new System.Data.SqlClient.SqlCommand();
                comd.CommandText= ("INSERT INTO Symptom(s1, s2, s2, s4 )VALUES(@s1,@s2,@s3), s4");
                comd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);

            }
            comd.Connection.Close();
            comd.Dispose();





有人可以帮助将这些字符串放入数据库和检索的最佳方法他们在一个专栏中。

多谢数百万人。



Can some one help what is the best way to get these strings into database and retrieve them in a single column.
Thanks in advace in millions.

推荐答案

你好试试这个



Hello Try this

foreach (string list in listBox1.Items)
{

          
}


这篇关于不是计算机专家 - 需要帮助列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆