我在表单load ivent GetProducts("")上调用此方法; 这个查询在sql中工作正常.它一直工作,直到我添加WHERE当我在这一行使用调试器>> SqlDataReader myReader = cmd.ExecuteReader(); 任何人都可以建议我吗?
public void GetProducts(string find)
{
try
{
using (SqlCommand cmd = new SqlCommand("SELECT ID, BarCode, ArtNumber, ProductName, Price, SelfPrice, PriceWithOutAWD, TotalSelfPrice, UnitsInStock, " +
" Comment, InputDateTime, InputQuantity, Margin, CategoryName, TypeName, ExpDate FROM GetProducts"+
"WHERE BarCode LIKE '%@F%' OR ArtNumber LIKE '%@F%' OR ProductName LIKE '%@F%' OR Price LIKE '%@F%' OR Comment LIKE '%@F%' ",
new SqlConnection(Program.ConnectionString)))
{
cmd.Parameters.AddWithValue("@F", find);
cmd.Connection.Open();
SqlDataReader myReader = cmd.ExecuteReader();
while (myReader.Read())
{
ProductTable.Rows.Add
(
(int)myReader["ID"], …Run Code Online (Sandbox Code Playgroud) 我怎样才能声明一个可以永远保存刺痛的变量?
我的意思是如果用户关闭并重新启动程序,则此字符串值不会丢失.
如何才能做到这一点?
你好我不能按字母顺序排序我的datagridview
这就是我填充网格的方式:
bs = new BindingSource();
bs.DataSource = db.GetProducts.ToList();
dgvInventory.DataSource = bs;
Run Code Online (Sandbox Code Playgroud)
这就是我尝试排序网格的方式:
private void toolStripButton3_Click_1(object sender, EventArgs e)
{
bs.Sort = "ID DESC, Name ASC";
dgvInventory.DataSource = bs;
}
Run Code Online (Sandbox Code Playgroud)
当我按下按钮没有任何反应这两列是数据网格中的exsist
这是屏幕:

我有CSS和HTML的问题我无法理解为什么会发生这种情况
HTML:
<body>
<div id="header">
<div id="header_conteiner">
<div id="logo_container">
<img src="images/logo.png" />
</div>
<input type="text" id="txtSearch" class="text_input" />
</div>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
CSS:
body{
background:#787777;
font-family:"Droid Sans",Helvetica,Arial,Sans-Serif;
font-size:0.81em;
margin: 0px;
padding: 0px;
}
#header{
height:100px;
background:#000000;
width:100%;
margin:0px;
border:0px solid #6F3;
}
#header_conteiner{
width:1000px;
height:100px;
border:1px solid #9F0;
margin:0 auto;
}
#logo_container{
padding-top:3px;
width:237px;
height:100px;
border:1px solid #03F;
}
#txtSearch{
width:220px;
height:20px; float:right;
}
Run Code Online (Sandbox Code Playgroud)
结果如下:

正如你在图像输入文字中看到的那样,header_conteiner任何人都可以给我一些建议吗?
我想在Windows 7 x64上安装我的Windows服务
并得到这个错误
An exception occurred during the Rollback phase of the System.Diagnostics.EventLogInstaller installer.
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.
Run Code Online (Sandbox Code Playgroud)
这是我的MyWindowsServiceInstaller代码:
var processInstaller = new ServiceProcessInstaller();
var serviceInstaller …Run Code Online (Sandbox Code Playgroud) 我正在使用DataGridView单元格的值填充ComboBox.现在,我不想重复ComboBox中已有的值.
所以,有例如:
我想删除多次出现的所有值.
这是我的代码:
private void btnFilter_Click(object sender, EventArgs e)
{
ArrayList SellerNameList = new ArrayList();
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
SellerNameList.Add(dataGridView1.Rows[i].Cells["cSellerName"].Value);
}
comboBox1.DataSource = SellerNameList;
}
Run Code Online (Sandbox Code Playgroud)
对不起,我的英语不好.
我怎样才能结合combobox1到dgv.Columns["cLoadName"]?所以我的Combobox总是在列标题文本之上.
我使用此代码在主窗体上显示用户控件
private void MainForm_Load(object sender, EventArgs e)
{
Sell sell = new Sell();
sell.Dock = DockStyle.Fill;
this.Controls.Add(sell);
}
Run Code Online (Sandbox Code Playgroud)
我想从主窗体中删除此用户控件,但此代码不起作用
this.Controls.Remove(sell);
Run Code Online (Sandbox Code Playgroud)
我试过this.Parent.controls.Remove(sell);但它也不起作用.请指教一下......
如何使用WPF WebBrowser组件从C#中的网页获取元素值?
例如,我想从此页面http://www.forexpros.com/currencies/usd-gel获得此值1.7655 .
谢谢