Imports System.Data Imports System.Data.OleDb PublicClass Conn Dim myConnection As OleDbConnection Dim myCommand As OleDbCommand Dim myDataadapter As SqlDataAdapter Dim myDatareader As OleDbDataReader Dim myDataset As DataSet '连接数据库 PublicFunction Conection(ByVal strConn) myConnection =New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source="& strConn)
myConnection.Open() EndFunction
'判断数据库中的字段是否为空 PublicFunction DbLen(ByVal Field AsObject)AsInteger DimlenAsInteger Dim NewVar AsString="" Dim ObjType As Type = Field.GetType() If ObjType.FullName="System.DBNull"Then
NewVar = Field.Value.ToString Else
NewVar = Field EndIf Return NewVar.Length EndFunction EndClass
<% Dim conn AsNew Conn() Dim dtr As OleDbDataReader Dim sql AsString
conn.Conection(Request.ServerVariables("APPL_PHYSICAL_PATH")&"common\survey.mdb") If request.Form("radio_survey")<>""Then
sql="UPDATE tb_surveyitem SET surveyitem_item"& request.Form("radio_survey")&"=surveyitem_item"& request.Form("radio_survey")&"+1 WHERE surveyitem_survey="& request.Form("hidden_surveyid")
conn.ExecuteUpdate(sql) EndIf
dtr=conn.ExecuteQuery("select * from tb_survey,tb_surveyitem where survey_id=surveyitem_survey and survey_id="& request.Form("hidden_surveyid"))
dtr.Read()
%>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#333333">
<tr>
<td><table width="500" border="0" cellspacing="1" cellpadding"0">
<tr align="center">
<td colspan="2" bgcolor="#006699"class="title_text1"><strong><%=dtr("survey_title")%></strong></td>
</tr>
<% Dim I AsInteger For I =1To6 If conn.DbLen(dtr("survey_item"& I &"title")) > 0then
%>
<tr>
<td width="100" bgcolor="#006699"class="title_text1"><%=dtr("survey_item"& I &"title")%></td>
<td width="400" bgcolor="#ECF9FF" valign=middle>
<img src='images/left-line.gif' width='<%=dtr("surveyitem_item" & I)*10%>' height=10>
</td>
</tr>
<% EndIf Next
%>
</table></td>
</tr>
</table>
<%
dtr.Close()
conn.Close()
%> '---------------------------------------------
<TABLE cellSpacing=2 cellPadding=2width=600 bgColor=#ffffff>
<TBODY>
<TR class="content_text1">
<TD bgColor=#bfd5e3 colSpan=6>招聘信息</TD>
</TR>
<% Dim conn AsNew Conn() Dim dtr As OleDbDataReader
conn.Conection(Request.ServerVariables("APPL_PHYSICAL_PATH")&"common\hr.mdb")
dtr=conn.ExecuteQuery("select * from tb_hr where hr_state=1") While dtr.Read()
%>
<TR class="content_text1">
<TD width=10% bgColor=#e9e9e9>职位名称:</TD>
<TD width=50%><%=dtr("hr_job")%></TD>
<TD width=10% bgcolor="#E9E9E9">性别要求:</TD>
<TD width=10%><%=dtr("hr_gender")%></TD>
<TD width=10% bgcolor="#E9E9E9">招聘人数:</TD>
<TD width=10%><%=dtr("hr_num")%></TD>
</TR>
<TR class="content_text1">
<TD width=10% valign="top" bgColor=#e9e9e9>职位描述:</TD>
<TD colspan="5"><%=Replace(dtr("hr_desc"),vbCrLf,"<br>")%></TD>
</TR>
<TR class="content_text1">
<TD bgColor=#bfd5e3 colspan="6"> </TD>
</TR>
<% EndWhile
dtr.Close()
conn.Close()
%>
</TBODY>
</TABLE> '--------------------------------------------- Dim conn AsNew Conn() Dim ds As DataSet Dim dr As DataRow
ds = conn.ExecuteToDataAdapter("select * from tb_board","board") ForEach dr In ds.Tables("board").Rows
response.write(dr("board_id")) Next