一套正版网络棋牌游戏程序 第一次上传 请多多指教

源代码在线查看: procedure.cst

软件大小: 2776 K
上传用户: machao844655
关键词: 网络 游戏程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
				
								OpenResponse("Procedure.sql");
				DbEntity db = Template.GetDataBase(databaseName);
				foreach(Table tb in db.Tables)
				{
					if( tableName !="" && tableName != null && tableName != tb.Name)
						continue;
					
					int iFieldCount = tb.Fields.Count;
					int iField = 0;
					int iPkFieldCount = 0;
					int iPkField = 0;
					int iNoPkField = 0;
					int iDefaultIdentityField = 0;
					int iDefaultIdentityFieldCount = 0;
					int iPkIdenField = 0;
					int iPkIdenFieldCount = 0;
					string pkString = "";
					string firstPk = "";
					string pkParamList = "";
					string allParamList = "";
					
					string nopkIdenParamSqlEq = "";
				 	string pkSqlEq = "";
				 	string noPkSqlEq = "";
				 	
					foreach(Field fd in tb.Fields)
					{
						if( fd.IsPK == true)
							iPkFieldCount++;
						if( fd.IsPK == false && fd.Identity.Enable == false)
							iPkIdenFieldCount ++;
					}
					
					foreach(Field fd in tb.Fields)
					{	
						iField++;
						if( fd.Identity.Enable == true || (fd.DefaultValue != "" && fd.DefaultValue != null))
							iDefaultIdentityFieldCount++;
							
						if( fd.IsPK == true)
						{
							iPkField++;
							pkString += fd.PropertyName;
							if( firstPk == "")
								firstPk = fd.PropertyName;
				
							//pkParamList
							pkParamList += "\t@"+fd.PropertyName+" "+fd.DataType.FullName;
							if(iPkField != iPkFieldCount)
								pkParamList +=",\r\n";
				
							//pkSqlEq 
							pkSqlEq += "\t["+fd.PropertyName+"] = @"+fd.PropertyName;
							if(iPkField != iPkFieldCount)
								pkSqlEq += ",\r\n";
						}
						else
						{
							iNoPkField++;
							//noPkSqlEq
							
							noPkSqlEq += "\t["+fd.PropertyName+"] = @"+fd.PropertyName;
							if(iNoPkField != iFieldCount - iPkFieldCount)
								noPkSqlEq += ",\r\n";
						}
						
						if( fd.IsPK == false && fd.Identity.Enable == false)
						{
							iPkIdenField ++;
							nopkIdenParamSqlEq+= "\t["+fd.PropertyName+"] = @"+fd.PropertyName;
							if(iPkIdenField != iPkIdenFieldCount)
								nopkIdenParamSqlEq += ",\r\n";
						}
						
						//allParamList
						allParamList += "\t@"+fd.PropertyName+" "+fd.DataType.FullName;
						if(iField != iFieldCount)
							allParamList +=",\r\n";
					} 
					
					string insert = prefix+"_Insert"+tb.PropertyName;
					string update = prefix+"_Update"+tb.PropertyName;
					string deleteByPk = prefix+"_Delete"+tb.PropertyName+"By"+pkString;
					string delete = prefix+"_Delete"+tb.PropertyName;
					string selectByPk = prefix+"_Select"+tb.PropertyName+"By"+pkString;
					string selectAll = prefix+"_SelectAll"+tb.PropertyName;
					string select = prefix+"_Select"+tb.PropertyName;
					string selectPaged = prefix +"_SelectPaged"+tb.PropertyName;
				%>
				/*==================================================
				* 
				*
				*=================================================*/
				IF OBJECT_ID(N'[dbo].[]') IS NOT NULL
					DROP PROCEDURE [dbo].[]
				IF OBJECT_ID(N'[dbo].[]') IS NOT NULL
					DROP PROCEDURE [dbo].[]
				IF OBJECT_ID(N'[dbo].[]') IS NOT NULL
					DROP PROCEDURE [dbo].[]
				IF OBJECT_ID(N'[dbo].[]') IS NOT NULL
					DROP PROCEDURE [dbo].[]
				IF OBJECT_ID(N'[dbo].[]') IS NOT NULL
					DROP PROCEDURE [dbo].[]
				IF OBJECT_ID(N'[dbo].[]') IS NOT NULL
					DROP PROCEDURE [dbo].[]	
				IF OBJECT_ID(N'[dbo].[]') IS NOT NULL
					DROP PROCEDURE [dbo].[]
				IF OBJECT_ID(N'[dbo].[]') IS NOT NULL
					DROP PROCEDURE [dbo].[]
				GO
				
				
				/*Insert=================================================*/
				CREATE PROCEDURE [dbo].[]
								iField = 0;
				foreach(Field fd in tb.Fields)
				{
					if( fd.Identity.Enable == false && (fd.DefaultValue == "" || fd.DefaultValue == null))
					{
						iField++;
						Response.Write("\t@"+fd.PropertyName+" "+fd.DataType.FullName);
						if(iField != iFieldCount - iDefaultIdentityFieldCount)
							Response.Write(",\r\n");
					}
				}
				%> 
				AS 
				INSERT INTO [dbo].[] (
								iField = 0;
				foreach(Field fd in tb.Fields)
				{
					if( fd.Identity.Enable == false && (fd.DefaultValue == "" || fd.DefaultValue == null))
					{
						iField++;
						Response.Write("\t["+fd.PropertyName+"]");
						if(iField != iFieldCount - iDefaultIdentityFieldCount)
							Response.Write(",\r\n");
					}
				}
				%> 
				) VALUES (
								iField = 0;
				foreach(Field fd in tb.Fields)
				{
					if( fd.Identity.Enable == false && (fd.DefaultValue == "" || fd.DefaultValue == null))
					{
						iField++;
						Response.Write("\t@"+fd.PropertyName);
						if(iField != iFieldCount - iDefaultIdentityFieldCount)
							Response.Write(",\r\n");
					}
				}
				%>
				)
				SELECT @@RowCount
				GO
				
				/*update=================================================*/
				
				CREATE PROCEDURE [dbo].[]
				 
				AS 
								{
				%>
				UPDATE [dbo].[] SET
				
				WHERE
				
								}
				%>
				SELECT @@RowCount
				GO
				
				/*DeleteByPk=================================================*/
				
				CREATE PROCEDURE [dbo].[]
				
				AS 
				DELETE [dbo].[]
				WHERE
				
				SELECT @@RowCount
				GO
				
				/*delete=================================================*/
				
				CREATE PROCEDURE [dbo].[]
					@where varchar(256)
				AS
				DECLARE @strSQL nvarchar(1000)
				set @strSQL = 'delete from [dbo].[] '+@where
				exec sp_executesql @strSQL
				SELECT @@RowCount
				GO
				
				/*selectByPk=================================================*/
				
				CREATE PROCEDURE [dbo].[]
				
				AS 
				SELECT * FROM [dbo].[]
				WHERE
				
				GO
				
				/*selectAll=================================================*/
				
				CREATE PROCEDURE [dbo].[]
				AS 
				SELECT * FROM [dbo].[]
				GO
				
				CREATE PROCEDURE [dbo].[]
					@where varchar(256)
				AS
				DECLARE @strSQL nvarchar(1000)
				set @strSQL = 'select * from [dbo].[] '+@where
				exec sp_executesql @strSQL
				GO
				
				/*selectPaged=================================================*/
				
				CREATE PROCEDURE [dbo].[] 
				@pageIndex int,
				@pageSize int,
				@GetCount int,
				@where varchar(255)=''
				As
				DECLARE @strSQL nvarchar(1000)
				DECLARE @strWhereTemp nvarchar(1000)
				DECLARE @strPageTemp nvarchar(1000)
				
				set @strWhereTemp = @where
				if @pageIndex > 1 
				begin
				   set @strPageTemp = '  not in (select top '+str((@pageIndex-1)*@pageSize) +'  from  ' + @where+')'
				   if @strWhereTemp = ''
				      set @strWhereTemp = 'where '+@strPageTemp
				   else
				      set @strWhereTemp = @strWhereTemp +' and '+@strPageTemp
				end
				
				set @strSQL = 'select top '+str(@pageSize)+' * from  '+@strWhereTemp
				exec sp_executesql @strSQL
				
				if @GetCount != 0
				begin
				set @strSQL = 'select count(*) from  ' + @where 
				exec sp_executesql @strSQL
				end
				
				GO
				
								}
				CloseResponse();
				SpApi.get_Commands().Run("OpenCommand","DirectFileName;"+FullFileName);
				%>
							

相关资源