PropertyInfo[] property = myQuestionMain.GetType().GetProperties();
foreach (PropertyInfo p in property)
{
if (p.GetValue(myQuestionMain, null) != null && p.GetValue(myQuestionMain, null).ToString() != "0")
{
str += p.Name + "='" + p.GetValue(myQuestionMain, null) + "' and ";
}
}
把这个foreach循环改写成for循环
解决方案 »
- 用.net自带的打包工具如何让其安装完后自动执行一个bat文件
- 多线程占cup100%问题优化
- 为什么不能动态添加DotNetBar的控件呢?
- GUID的问题
- 〓【〓.mobi手机域名注册倒计时,发财机会一起分享〓】〓
- float类型为什么在此处不能付小数。高手请进。up有分。
- 管道和TCP连接sql server连接字符串各怎么写????高手指点
- winform 如何执行接收的委托事件
- 求救:socket异步,通信到一半时,发生异常:System.Net.Sockets.SocketException (0x80004005):
- 这里到底有没有斑竹???
- Winform中欠套的EXCEL如何使它退出编辑状态
- 如何对输入的数字排序 ,保存到动态数组C# 如,8366,45,123,789 输入的数组不是固定的!
for (int i=0;i<property.Length;i++)
{
if (property[i].GetValue(myQuestionMain, null) != null && property[i].GetValue(myQuestionMain, null).ToString() != "0")
{
str += property[i].Name + "='" + property[i].GetValue(myQuestionMain, null) + "' and ";
}
}
PropertyInfo[] property = myQuestionMain.GetType().GetProperties();
for(int i=;i<property.length;i++)
{
if (property(i).GetValue(myQuestionMain, null) != null && property(i).GetValue(myQuestionMain, null).ToString() != "0")
{
str += property(i).Name + "='" + property(i).GetValue(myQuestionMain, null) + "' and ";
}
}
for (int i=0;i<property.length;i++)
{
if (property[i].GetValue(myQuestionMain, null) != null && property[i].GetValue(myQuestionMain, null).ToString() != "0")
{
str += property[i].Name + "='" + property[i].GetValue(myQuestionMain, null) + "' and ";
}
}
for (int i=0;i <property.Length;i++)
{
if (property[i].GetValue(myQuestionMain, null) != null && property[i].GetValue(myQuestionMain, null).ToString() != "0")
{
str += property[i].Name + "='" + property[i].GetValue(myQuestionMain, null) + "' and ";
}
}
{
PropertyInfo p =(PropertyInfo)property[i];
if (p.GetValue(myQuestionMain, null) != null && p.GetValue(myQuestionMain, null).ToString() != "0")
{
str += p.Name + "='" + p.GetValue(myQuestionMain, null) + "' and ";
}
}
for(int i=;i<property.length;i++)
{
if (property[i].GetValue(myQuestionMain, null) != null && property[i].GetValue(myQuestionMain, null).ToString() != "0")
{
str += property[i].Name + "='" + property[i].GetValue(myQuestionMain, null) + "' and ";
}
}
for (int i=0,i<property.length,i++)
{
if (property[i].GetValue(myQuestionMain, null) != null && property[i].GetValue(myQuestionMain, null).ToString() != "0")
{
str += property[i].Name + "='" + property[i].GetValue(myQuestionMain, null) + "' and ";
}
}
PropertyInfo p=property[i];
}
{
PropertyInfo[] property = myQuestionMain.GetType().GetProperties();
for(int i=0;i<property.Length;i++)
{
if (property[i].GetValue(myQuestionMain, null) != null && property[i].GetValue(myQuestionMain, null).ToString() != "0")
{
str += property[i].Name + "='" + property[i].GetValue(myQuestionMain, null) + "' and ";
}
}
PropertyInfo[] property = myQuestionMain.GetType().GetProperties();
for(int i=0;i<property.Length;i++)
{
if (property[i].GetValue(myQuestionMain, null) != null && property[i].GetValue(myQuestionMain, null).ToString() != "0")
{
str += property[i].Name + "='" + property[i].GetValue(myQuestionMain, null) + "' and ";
}
}
{
if (PropertyInfo[i].GetValue(myQuestionMain, null) != null && PropertyInfo[i].GetValue (myQuestionMain, null).ToString() != "0")
{
str += PropertyInfo[i].Name + "='" + PropertyInfo[i].GetValue(myQuestionMain, null) + "' and ";
}
}