ASP.NET取网页数据《数据采集》
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string strURl = "http://www.jxflcp.net/ssc/";//换成你要的那个网址
string str = GetHttp(strURl);
if (str != "xx")
{
//换成你想要截取网页部分内容的代码
Regex reg = new Regex(@"<td width=""100"" height=""22"" style=""font-size: 14px;font-weight: bold;color: #006600;"">(\d+)</td>[\s\r\n]*<td width=""80"" style=""font-size: 14px;font-weight: bold;color: #0099FF;"">([\d\s\:]+)</td>[\s\r\n]*<td width=""100"" style=""font-size: 14px;font-weight: bold;color: #cc0000;"">([\d,\s]+)</td>");
if (reg.IsMatch(str))
{
MatchCollection mc = reg.Matches(str);
foreach (Match m in mc)
{
Response.Write(m.Result("
相关文档:
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Net.Configuration;
namespace BCore.PubFunction
{
public class MailHandler
{
&n ......
1.C#连接连接Access
程序代码:
------------------------------------------------------------------------------- using System.Data;
using System.Data.OleDb;
..
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+=@"Data Source=C:BegASPNETNorthwind.mdb";
Ol ......
首页:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......
此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElem ......
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
......