类1:
protected const string insertStr = "insert into {0}{1} select {2}";类2:
using System;
using System.Data;
namespace DataObject
{
/// <summary>
/// CommunityDataObject 的摘要说明。
/// </summary>
public class CommunityDataObject
{
public CommunityDataObject()
{
// TODO: 在此处添加构造函数逻辑
}
public string TableName = "Community";
private int _CommunityID;
private string _CommunityName;
private string _Re;
public virtual int CommunityID
{
get{return _CommunityID;}
set{_CommunityID = value;}
}
public virtual string CommunityName
{
get{return _CommunityName;}
set{_CommunityName = value;}
}
public virtual string Re
{
get{return _Re;}
set{_Re = value;}
} }
}现在想获取"类2"中的字段:CommunityID,CommunityName,Re(CommunityID是主键自增字段)
并用"类1"中的SQL语句重新构造一条插入到表(Community)的SQL语句?请帮忙写出获取字段列表函数,和构造SQL的函数.谢谢.
protected const string insertStr = "insert into {0}{1} select {2}";类2:
using System;
using System.Data;
namespace DataObject
{
/// <summary>
/// CommunityDataObject 的摘要说明。
/// </summary>
public class CommunityDataObject
{
public CommunityDataObject()
{
// TODO: 在此处添加构造函数逻辑
}
public string TableName = "Community";
private int _CommunityID;
private string _CommunityName;
private string _Re;
public virtual int CommunityID
{
get{return _CommunityID;}
set{_CommunityID = value;}
}
public virtual string CommunityName
{
get{return _CommunityName;}
set{_CommunityName = value;}
}
public virtual string Re
{
get{return _Re;}
set{_Re = value;}
} }
}现在想获取"类2"中的字段:CommunityID,CommunityName,Re(CommunityID是主键自增字段)
并用"类1"中的SQL语句重新构造一条插入到表(Community)的SQL语句?请帮忙写出获取字段列表函数,和构造SQL的函数.谢谢.
解决方案 »
- 这个字符串处理,该怎么做?
- MemoryStream()参数无效。各位大神帮忙看看。
- 如何用C#写dll给c++调用?
- C# 点击listview时为什么只能选中每列的第一项啊?怎么解决?
- 【版务帖】2009年9月C#版务帖
- 大哥们看看这个功能是怎么实现的,告诉小弟一下!急。。。!!!在线等。。。
- 高分求DataGridViewCheckBoxCell状态问题. 100求解!~~急..
- 有高手开发过想kugoo一样的软件吗?在应用程序中加载WEB页面等等。。是怎么做的??要用到什么技术
- 水晶报表在win98上打印出的某些汉字是重叠在一起的?
- 留言板中数据库连接语句到底该怎么写,我用了以下代码,老是说数据库连接出错,是用Vs.net2005和sql2005的
- 紧急求助!关于收费会员制网站的登录控制问题。
- 请大家帮帮忙,解决一个C#2005与SQL数据库的问题。
我想CommunityID是主键的话,就必须把CommunityID也插到表community,但表community 的CommunityID不能自增了