62,046
社区成员
发帖
与我相关
我的任务
分享
string Sql = " Select [SpecialID],[SpecialCName],[SavePath],[saveDirPath],[FileName],[FileEXName],[isDelPoint] From [" + DBConfig.TableNamePrefix + "news_special] Where [ParentID]='" + this.Param_CurrentSpecialID + "'";
DataTable dt = CommonData.DalPublish.ExecuteSql(Sql);
if (dt == null || dt.Rows.Count == 0) return "";
for (int i = 0; i < dt.Rows.Count; i++)
{
select t1.name,t3.name form table1 t1 inner join table2 t2 on t1.t1id=t2.id inner join table3 t3 on t2.t3id=t3.id where t1.id=123
string s_newsSql = "select top " + Param_Loop + " " + SqlFields + " from" +
" " + SqlCondition + " inner join [" + DBConfig.TableNamePrefix + "Special_news] on [" + DBConfig.TableNamePrefix + "news].NewsID=[" + DBConfig.TableNamePrefix + "Special_news].SpecialID where [SpecialID]='" + dt.Rows[i]["SpecialID"].ToString() + "' + SqlOrderBy";
Select * from special_news where specialID='"+dt.Rows[i].Item["SpecialID"].toString()+"'
public int Insert( int userID,DateTime loginTime,DateTime logoutTime ) {
//构造SQL语句
string sql = "INSERT INTO [Loginfo](UserID,LoginTime,LogoutTime)VALUES(@UserID,@LoginTime,@LogoutTime); SELECT @@Identity";
//构造参数
SqlParameter[] parameters = {
new SqlParameter("@FinaId",SqlDbType.DateTime),
new SqlParameter("@UserId",SqlDbType.DateTime),
new SqlParameter("@FinaType",SqlDbType.DateTime),
};
//为参数赋值
int i = 0;
parameters[ i++ ].Value = userID;
parameters[ i++ ].Value = loginTime;
parameters[ i++ ].Value = logoutTime;
//执行SQL语句
try {
object obj = db.ExecuteScalar( CommandType.Text, sql, parameters ) ?? "-1";
int Identity;
if( int.TryParse( obj.ToString(), out Identity ) )
return Identity;
return -1;
} catch( Exception exp ) {
throw exp;
}
}
declare @specialID int
set @specialID = 1
select * from news a
inner join special_news b
on a.newsid = b.newsid
where specialID = @specialID