Source code for a data set

zhaozj2021-02-16  85

Imports system.componentmodelimports system.web.uiimports system.data.sqlclientimports system.data

")> _Public Class ResultPage Inherits System.Web.UI.WebControls.Panel Implements System.Web. Ui.inamingContainer

DIM _DS AS DATASET 'THE Interfase of The DataSet Dim Sqlconn As SqlConnection' The Connection Database Dim ResultDataSet AS New DataSet 'The Dataset Of All Result Dim_pageid As String' ペ ペ ジ ID

Property Dataset () AS Dataset

Get return _ds end get

Set (Byval Value As Dataset )_ds = value End Set

End Property

Property PageId () AS String

Get return _PageId End Get

Set (Byval Value As String) _PageId = Value End Set

End Property

Readonly Property Conn () AS STRING

Get return system.configuration.configurationSettings.appsettings ("sqlconn") End Get

End Property

Public sub sqldbconn ()

SQLCONN = New SqlConnection (conn ())

End Sub

'********************************************************** ** '[プ プ シ シ ジャ ID]: 001' [プ プ シ シ ジャ]: getAllDataSet '[function]: get all dataset result' [引 数]: '[戻 戻 値]: DataSet' [歴] '変 変 日 内容 内容 内容 内容' - ------------------------------------------------- 2004/08/03 WF made a '****************************************************** ********* Public Function GetAllDataSet () As DatasetDim theStrSql As String Dim theResult As Boolean Dim theStrReault As String Dim thePictArr As Array Dim theRecordCount As Integer Dim theString As String = "" Dim i As Integer

'Get All images thestrsql = "Select Distinct K.fid, K.FName, D.Storage, A.CValue, A.Alid, at.atname, ag.agname" theestrsql = theestrsql "from k" Testrsql = theestrsql " Inner Join A on k.fid = a.fid "aw" theestrsql = theestrsql "Inner Join D on K.DID = DID" THESTRSQL = TheSTRSQL "inner join at at at.atid = a.atid" THESTRSQL = theestrsql "Inner Join Ag on Ag.agID = a.agid" thesesql = theestrsql "WHERE A.FID IN (" THESTRSQL = Theestrsql "Select A.fid from a where a.agid = (Select Agid from AG Where Agname = ' Products Shao ペ ペ ジ ') And a.acvalue =' GB_115 ') "" Theresult = FungetDataSet (TheSTRSQL, "DSIMAGE") ife ("DSIMAGE") if theresult = false the' Add log endiff

'Get All Mess Theestrsql = "Select Distinct K.FID, K.FName, D.Storage, A.AcValue, A.Alid, at.atname, ag.agname" theestrsql = theestrsql "from k" THestrsql = thesestrsql " Inner Join A on k.fid = a.fid "aw" theestrsql = theestrsql "Inner Join D on K.DID = DID" THESTRSQL = TheSTRSQL "inner join at at at.atid = a.atid" THESTRSQL = theestrsql "Inner Join Ag on Ag.agID = a.agid" thesesql = theestrsql "WHERE A.FID IN (" THESTRSQL = Theestrsql "Select A.fid from a where a.agid = (Select Agid from AG Where Agname = ' Information models ') AND a.acvalue =' gb_115 ') "theResult = funGetDataSet (theStrSql," DsMess ") If theResult = False Then' add log End If'Get The PictNumber theStrSql =" select acvalue from a "theStrSql = theStrSql "WHERE A.FID IN (SELECT A.FID from a where a.agid" theestrsql = the agname = 'Variety Intelligence') And a.acvalue = 'GB_115') "THESTRSQL = theStrSql "and a.atid in (select atid from at where atname = 'PICT intelligence')" theStrReault = funGetFieldValue (theStrSql, "acvalue") If theStrReault = "" Then 'add log Else theString = Replace (theStrReault, "- ",", ")

'Get the pictimages theestrsql = "Select Distinct K.FID, K.FNAME, K.DID, D.Storage" theestrsql = theestrsql "from k" theestrsql = theestrsql "Inner Join D on K.DID = DID" THESTRSQL = theestrsql "Where k.fid in (" these ")" "Theresult = FungetDataSet (TheSTRSQL," DSPICT ") if theresult = false the 'add log end if Endiff

'Get the HorsePower theStrSql = "select acvalue from a" theStrSql = theStrSql "where a.fid in (select a.fid from a where a.agid" theStrSql = theStrSql "in (select agid from ag where agname =' model Intelligence ') and a.acvalue =' gb_115 ') "TheSTRSQL = theestrsql " and a.atid in (SELECT ATID AT WHERE ATNAME =' Horsepower ') "Theresult = FungetDataSet (TheSTRSQL," DshorsePower ") if theresult = False Then 'Add log endiff

Return RESULTDATASET

END FUNCTION

'********************************************************** ** '[プ プ シ シ ジャ]]: 002' [プ プ シ シ ジャ]: getDataSet '[function]: execute the strsql and get the resultset' [quotes]: strsql = the content of sql ': startAblename = the name of table': ' [戻 戻 値]: True = Success; false = failure '[歴]' 変 変 日 者 内容 '--------------------------- ------------------------ '2004/08/03 wf is a' **************** ********************************** Public Function FungetDataSet (Byval Instarsql AS String, Byval InstthAme As String) AS Booleandim SQLCommand as Sqlcommand Dim Dapadpater As SqldataAdapter

SqlCommand = New SqlCommand (inStrSql, SqlConn) DapAdpater = New SqlDataAdapter (SqlCommand) Try SqlConn.Open () DapAdpater.Fill (ResultDataSet, inStrTableName) Return True Catch ex As Exception 'Add the log file Return False Finally SqlConn.Close () End Try

END FUNCTION

'********************************************************** ** '[プ プ シ シ ジャ ID]: 003' [プ プ シ シ ジャ]: getfieldValue '[function]: execute the strsql and get the value from a field' [quotes]: strsql = the content of sql ': startAblename = the name of FIELD ':' [戻 戻 値]: there t et '[歴]' 変 変 日 者 内容 '---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------- '2004/08/03 WF is a' ******************* ***************************************** Public Function FungetfieldValue (Byval InstrfieldName As String) AS STRINGDIM SQLCOMMAND AS SQLCOMMAND Dim TheDataReader As SqldataReader Dim Outreturn As String = ""

Sqlconn.open () sqlcommand = new sqlcommand (instrsql, sqlconn) thisDataReader = SQLCommand.executeReader ()

While theDataReader.Read () Outreturn = theDataReader.Item (InstrfieldName) End while

THEDATAREADER.CLOSE () sqlconn.close () Return Outreturn

END FUNCTION

Protected Overrides Sub Online (Byval E AS System.EventArgs)

'Get the value from Web if mybase.parent.page.Session ("PageID") <> "" "") Endiff ("PageID")

End Subend Class

转载请注明原文地址:https://www.9cbs.com/read-10479.html

New Post(0)