1、端庄海燕/p //基于. NET 2.0,只有2.0包含端庄海燕/p using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using system.web.services.protocols;
using system.security.cryptography;
using System.IO;
using system.collections.generic;
using System.Configuration;
使用包装;
using kwdxmg;
publicpartialclassorclservice : system.web.ui.page
{
protectedvoidpage _ load (object sender,EventArgs e ) ) ) ) ) ) )。
{
response.add header (' access-control-allow-origin ',' * ' );
List result=new List (;
string callback=request.query string [ ' method ' ];
if(callback=='gettableinfo ' )
result=getTableInfo (;
Response.End (;
}
//
privatestaticstringstrconn=configuration settings.appsettings [ ' orcl con ' ];
Oracle连接测试' ]公共列表获取信息(
{
List list=new List (;
conn.Open (;
stringstrcomm=' select * from atest _ polygon ';
oraclecommandcomm=neworaclecommand (str comm,conn );
oracledatareadersdr=comm.executereader (;
info strinfo=空;
while(SDR.read ) )
{
strInfo=new info (;
strInfo.ID=sdr['ID'].ToString (;
strinfo.content=SDR [ ' content ' ].tostring (;
list.add(strinfo );
}
if (! sdr.yldddd )
{
strInfo.Content='没有匹配的记录';
list.add(strinfo );
}
sdr.Close (;
返回列表;
}
公共类信息
{
私有字符串id;
公共字符串id
{
get { return this.id; }
set { this.id=value; }
}
私有字符串内容;
公共字符串内容
{
get { return this.content; }
set { this.content=value; }
}
}
}
2、odbc (请参阅Oracle通过odbc连接)。
使用系统;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.wsdxf;
using System.Web;
using System.Web.Services;
using system.web.services.protocols;
using System.Xml.wsdxf;
using system.security.cryptography;
using System.IO;
using system.collections.generic;
using System.Configuration;
使用包装;
using System.Data.Odbc;
publicpartialclassorclservice : system.web.ui.page
{
protectedvoidpage _ load (object sender,EventArgs e ) ) ) ) ) ) )。
{
response.add header (' access-control-allow-origin ',' * ' );
int result=0;
string callback=request.query string [ ' method ' ];
if(callback=='gettableinfo ' )
result=getTableInfo (;
Response.End (;
}
//
//
privatestaticstringstrconn=configuration settings.appsettings [ ' orcl con _ Linux ' ];
Oracle连接测试' ]公共信息获取信息(
{
odbcconnectionodbcconn=newodbcconnection (strconn );
odbcconn.Open (;
stringstrcomm=' select * from atest _ polygon ';
DataSet ds=new DataSet (;
odbcda.fill(ds;
DataTable dt=new DataTable (;
dt=ds.Tables[0];
odbcconn.Close (;
odbcconn.Dispose (;
return dt.Rows.Count;
}
}
3、mmdxn/p using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.wsdxf;
using System.Web;
using System.Web.Services;
using system.web.services.protocols;
using System.Xml.wsdxf;
using system.security.cryptography;
using System.IO;
using system.collections.generic;
using System.Configuration;
使用包装;
using System.Data.OleDb;
publicpartialclassorclservice : system.web.ui.page
{
protectedvoidpage _ load (object sender,EventArgs e ) ) ) ) ) ) )。
{
response.add header (' access-control-allow-origin ',' * ' );
List result=new List (;
string callback=request.query string [ ' method ' ];
if(callback=='gettableinfo ' )
result=getTableInfo (;
Response.End (;
}
//
//
privatestaticstringstrconn=configuration settings.appsettings [ ' orcl con _ windows ' ];
Oracle连接测试' ]公共列表获取信息(
{
List list=new List (;
oledbconnectionconn=newoledbconnection (strconn );
conn.Open (;
stringstrcomm=' select * from atest _ polygon ';
oledbcommandcomm=new oledbcommand (str comm,conn );
oledbdatareadersdr=comm.executereader (;
info strinfo=空;
while(SDR.read ) )
{
strInfo=new info (;
strInfo.ID=sdr['ID'].ToString (;
strinfo.content=SDR [ ' content ' ].tostring (;
list.add(strinfo );
}
if (! sdr.yldddd )
{
strInfo.Content='没有匹配的记录';
list.add(strinfo );
}
sdr.Close (;
返回列表;
conn.Close (;
conn.Dispose (;
返回列表;
}
公共类信息
{
私有字符串id;
公共字符串id
{
get { return this.id; }
set { this.id=value; }
}
私有字符串内容;
公共字符串内容
{
get { return this.content; }
set { this.content=value; }
}
}
}