System.Text.Encoding encoding=System.Text.Encoding.GetEncoding("gb2312");
System.IO.StreamReader reader=new System.IO.StreamReader(response.GetResponseStream(),encoding);
string htmlstr=reader.ReadToEnd();
System.IO.StreamReader reader=new System.IO.StreamReader(response.GetResponseStream(),encoding);
string htmlstr=reader.ReadToEnd();
解决方案 »
- System.Data.OleDb.OleDbException: UPDATE 语句的语法错误
- 做一个能够以文件夹为单位提取txt内容的winform,求助!
- C#程序,高分啊!要求:我有一组数字号码分为A.B.C.D.E五组,每组有24个数字号码或字母,现在要对每组数字号码进行分解
- C# 如何实现 FTP下载 ?
- C#数据库连接的问题
- C# winform 怎么做透明按钮
- 急!请问:如何在C#中连接EXCEL表?能不能给出例子?
- 请教各位高人,关于文本文件字符串查询的问题!
- c#中能嵌入汇编语言吗?
- crystal report中如何绑订从数据库中取出的dataset?
- 关于文件打包的问题
- listview如何能够象TreeView一样展开和收缩
我原本也想用webrequest或webclient类,但他们对于有些网址返回错误
byte[] by = System.Text.Encoding.GetEncoding("utf-8").GetBytes(str);
str = System.Text.Encoding.GetEncoding("GB2312").GetString(by);
Dim strReturn As String
strReturn = ""
Dim i As Integer Dim ThisChr As String Dim innerCode, Hight8, Low8 As Integer For i = 1 To vstrIn.Length ThisChr = Mid(vstrIn, i, 1) If Abs(Asc(ThisChr)) < &HFF Then
strReturn = strReturn & ThisChr
Else
innerCode = Asc(ThisChr)
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00) \ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
End If
Next
URLEncoding = strReturn
End Function
{
SqlConnection Conn=new SqlConnection("Server=.;DataBase=Test;UID=sa;PWD=;");
Conn.Open();
string strSql="select content from tblTest where name='html'";
SqlCommand cmd=new SqlCommand(strSql,Conn);
SqlDataReader dr=cmd.ExecuteReader(); mshtml.IHTMLDocument2 htmlDocument = (mshtml.IHTMLDocument2)axWebBrowser1.Document;
mshtml.IHTMLElement body = (mshtml.IHTMLElement)htmlDocument.body;
if(dr.Read())
{
body.innerHTML =(string)dr["content"];
}
dr.Close();
}