posts - 77, comments - 54, trackbacks - 0, articles - 0
  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

今天在连接Oracle的时候碰到一个问题,我的机器装的是Oracle9.2客户端,当在asp.net应用中使用数据访问的组件(调用System.Data.OracleClient)时,程序报“System.Exception: System.Data.OracleClient requires Oracle client software version 8.1.7 or greater”的错误,无法创建OracleConnection,但在同一台机器上用winfom客户端又能够正常访问到数据库。更加奇怪的是,我把应用部署到一台安装了Oracle 8.17客户端的机器上时,却能够正常运行。
        找了半天 ,终于搞清楚了原因。原来当Oracle 9.2运行在NTFS的分区上时,对于某些非administrator组的用户,ORACLE_HOME 目录是不可见的,而在windows server 2003下asp.net应用使用的帐户是netword service,因此无法创建oracle连接,只要重设一下ORACLE_HOME目录的权限就可以了。步骤如下:
1、以管理员的用户登录;
2、找到ORACLE_HOME文件夹(我的是C:\oracle\ora92),点右键,选属性--安全,在组或用户栏中选“Authenticated Users”,在下面权限列表中把“读取和运行”的权限去掉,再按应用;重新选上“读取和运行”权限,点击应用;选权限框下面的“高级”按钮,确认“Authenticated Users”后面的应用于是“该文件夹、子文件夹及文件”,按确定把权限的更改应用于该文件夹;
3、重新启动计算机,让权限设置生效(请注意,这一步很重要);
4、登录后运行asp.net应用,正常取得Oracle数据库的数据。

posted @ 2006-09-04 13:46 东人EP 阅读(546) | 评论 (1)编辑 收藏

     摘要: <!--  xWin by WildWind<http://wildcity.126.com>  --> < html > < head > ...  阅读全文

posted @ 2006-08-30 13:05 东人EP 阅读(856) | 评论 (0)编辑 收藏

<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
< html >
< head >
< title > ASPid's Blog menu Demo </ title >
< style  type ="text/css" >
<!--
#menu 
{
  width
: 8em ;
  padding
: 0.5em ;
  background
: #ccc ;
  font-family
:  "Terminal" ;
 
}

#menu a, #menu a:visited 
{
 display
: block ;  
 width
: 7em ;  
 color
: #669900 ;  
 text-align
: center ;  
 background-color
: #fff ;  
 text-decoration
: none ;
 margin
: 0.5em 0 ;  
 border-left
: 0.5em solid #9ab ;  
 
}

#menu a:hover 
{
 color
: #f00 ;  
 border-left
: 0.5em solid #000 ;  
 
}

.box 
{
 position
: relative ;
 
}

-->
</ style >
</ head >

< body >
< div  id ="menu" >
 
< div  class ="box" >
 
< href ="default.asp?cat=8" >
 IT News
 
</ a >
 
</ div >
 
< div  class ="box" >
 
< href ="default.asp?cat=1" >
 Web Design
 
</ a >
 
</ div >
 
< div  class ="box" >
 
< href ="default.asp?cat=5" >
 Development
 
</ a >
 
</ div >
 
< div  class ="box" >
 
< href ="default.asp?cat=4" >
 Art Design
 
</ a >
 
</ div >
 
< div  class ="box" >
 
< href ="default.asp?cat=9" >
 MX Studio
 
</ a >
 
</ div >
</ div >

</ body >
</ html >

posted @ 2006-08-30 12:58 东人EP 阅读(312) | 评论 (0)编辑 收藏

     摘要: 这是Html显示页面源码:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head>    <title>Image crop - DHTML user interface</title>   ...  阅读全文

posted @ 2006-08-30 12:51 东人EP 阅读(887) | 评论 (8)编辑 收藏

 1 using  System;
 2 using  System.Collections.Generic;
 3 using  System.ComponentModel;
 4 using  System.Data;
 5 using  System.Drawing;
 6 using  System.Text;
 7 using  System.Windows.Forms;
 8 using  System.Runtime.InteropServices;
 9
10 namespace  PlaySound
11 {
12      public  partial  class  Form1 : Form
13      {
14          //  应用动态连接库
15         [DllImport( " Winmm.dll " )]
16          public   static   extern   long  PlaySound( string  name,  long  module,  long  flag);
17
18          public  Form1()
19          {
20             InitializeComponent();
21         }

22
23          private   void  button1_Click( object  sender, EventArgs e)
24          {
25             PlaySound( @" C:\Program Files\QQ2005\sound\ring.wav " 23 23 );
26         }

27     }

28 }

posted @ 2006-08-19 07:45 东人EP 阅读(622) | 评论 (0)编辑 收藏

     摘要: 1 using  System;   2 using  System.IO;   3 using  System.Drawing;   4 using  Sy...  阅读全文

posted @ 2006-08-19 07:33 东人EP 阅读(589) | 评论 (0)编辑 收藏

XY空间方案
XY空间方案由表使用,根据每个记录的X和Y数据值构造Point几何体。XY空间方案可以应用到除Seamless、Views和ResultSet之外任意数据源的表
 1    class XYGeometry
 2    {
 3        public MapInfo.Data.Table CreateTable()
 4        {
 5            TableInfoServer ti = new TableInfoServer("Customers"
 6                "DRIVER={SQL Server};SERVER=localhost;DATABASE=Northwind;UID=sa;PWD=;Trusted_Connection=No;"
 7                "select * from customers", ServerToolkit.Odbc);
 8            SpatialSchemaXY xy = new SpatialSchemaXY();
 9            xy.CoordSysString = "CoordSys Earth Projection 1, 0";
10            xy.XColumn = "CustLoc_X";
11            xy.YColumn = "CustLoc_Y";
12            ti.SpatialSchema = xy;
13            MapInfo.Data.Table customers = MapInfo.Engine.Session.Current.Catalog.OpenTable(ti);
14            return customers;
15        }

16    }
PointRef空间方案
该方案使用表数据中的查找值,通过将查找值匹配到可制图的表来创建Point几何体对象。
 1class PointRefGeometry
 2    {
 3        public MapInfo.Data.Table CreateTable()
 4        {
 5            TableInfo ti = TableInfo.CreateFromFile(@"C:\data\customers.tab");
 6            SpatialSchemaPointRef pr = new SpatialSchemaPointRef();
 7            pr.StyleType = StyleType.None;
 8            pr.RefTable = "us_zips";
 9            pr.RefColumn = "zipcode";
10            pr.MatchColumn = "zip";
11            pr.RefTableLocation = @"C:\data\us_zips.tab";
12            ti.SpatialSchema = pr;
13            Table table = MapInfo.Engine.Session.Current.Catalog.OpenTable(ti);
14            return table;
15        }

16    }

posted @ 2006-08-18 12:22 东人EP 阅读(568) | 评论 (0)编辑 收藏

     摘要: 自定义控件       包括了用户自定义控件和定制控件两种方式,用户自定义控件是建立一个 .ascx 文件,将 ASP.NET 的控件进行组装,需要 ASP.NET 源代码,但定制控件则不同,定制控件本...  阅读全文

posted @ 2006-08-16 15:25 东人EP 阅读(380) | 评论 (0)编辑 收藏

Remoting 分布式应用程序

      .NET Remoting 可以用于访问另一个应用域中的对象,其体系结构额主要元素:

      远程对象:指运行在服务器上的对象,客户机不能直接调用远程对象上的方法,但是可以根据代理来调用。

      通道:用于客户机和服务器之间的通信。有 TCP HTTP 两种通道协议。

      消息:是为客户机和服务器之间的通信而创建的,消息被发送到通道中,消息中包含的内容:远程对象的信息、被调用的方法名称及所有参数。

      格式标识符:用于定义消息是如何传送到通道中的。

      格式标识符提供者:用于把格式标识符与通道连接起来。

      代理对象:客户机调用的是代理对象上的方法,而不是远程对象上的方法,代理对象包括两种:透明代理对象和真实代理对象。

      消息接收器:是一个截取器对象,在服务器和客户机上都有这样的对象,接收器与通道相联系,真实代理对象使用消息接收器把消息传送到通道中,因此在消息进入通道之前,接收器可以进行截取工作。

      激活器:客户机可以通过激活器在服务器上创建远程对象,或截取一个被激活的服务器对象的代理对象。

      RemotingConfiguration 类:用于配置远程服务器和客户机的实用类。

      ChannelServices 类:是一个实用类,可用于注册并把消息传送到通道中。

见如下简单例子:

远程对象:

      远程对象类继承于 MarshalByRefObject 并且定义了远程的实现方法,形成 Remoting 的装配件 Remoting.dll ,当服务器和客户机程序调用远程对象时需要引用装配件 Remoting.dll.

namespace Remoting

{

    public class HelloServer:MarshalByRefObject

    {

        public HelloServer()

        {

            System.Console.WriteLine("HelloServer activated");

        }

        public String HelloMethod(String name)

        {

            Console.WriteLine(

                "Server Hello.HelloMethod : {0}", name);

            return "Hi there " + name;

        }

    }

}

服务器:必须引用Remoting.dll的装配件,服务器上需要创建一个含有端口号的ServerChannel,这样远程对象就可以使用这个服务器通道了。WellKnownObjectMode.Singleton模式说明为每一个方法调用都创建新的实例,服务器不保存远程对象中的状态。

using System;

using System.Collections.Generic;

using System.Text;

using System.Runtime.Remoting;

using System.Runtime.Remoting.Channels;

using System.Runtime.Remoting.Channels.Tcp;

using System.Runtime.Remoting.Channels.Http;

using Remoting;

 

namespace Server

{

    class Program

    {

        static int Main(string[] args)

        {

            TcpChannel channel1 = newTcpChannel(8085);

            HttpChannel channel2 = newHttpChannel(8086);

 

            ChannelServices.RegisterChannel(channel1, false);

            ChannelServices.RegisterChannel(channel2, false);

 

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(HelloServer), "SayHello", WellKnownObjectMode.Singleton);

            System.Console.WriteLine("Enter Any Key,Exit");

            System.Console.ReadLine();

            return 0;

        }

    }

}

客户机:必须引用Remoting.dll的装配件,这里用到了反射原理,使得透明代理对象看起来象真实对象,实际是在反射机制下对取了真实对象的元数据。透明代理对象使用真实代理对象把消息发送给通道。

using System;

using System.Collections.Generic;

using System.Text;

using System.Runtime.Remoting;

using System.Runtime.Remoting.Channels;

using System.Runtime.Remoting.Channels.Http;

using System.Runtime.Remoting.Channels.Tcp;

using Remoting;

 

namespace Client

{

    class Program

    {

        static void Main(string[] args)

        {

            TcpChannel channel1 = newTcpChannel();

            ChannelServices.RegisterChannel(channel1, false);

             HelloServer obj1 = (HelloServer)Activator.GetObject(typeof(Remoting.HelloServer), "tcp://localhost:8085/SayHello");

            if (obj1 == null)

            {

                System.Console.WriteLine("Could not locate TCP server");

            }

 

             HttpChannel channel2 = newHttpChannel();

            ChannelServices.RegisterChannel(channel2, false);

            HelloServer obj2 = (HelloServer)Activator.GetObject(typeof(Remoting.HelloServer), "http://localhost:8086/SayHello");

            if (obj2 == null)

            {

                System.Console.WriteLine("Could not locate HTTP server");

            }

            Console.WriteLine("Client1 TCP HelloMethod {0}", obj1.HelloMethod("Caveman1"));

            Console.WriteLine("Client2 HTTP HelloMethod {0}", obj2.HelloMethod("Caveman2"));

            Console.ReadLine();

        }

    }

}

posted @ 2006-08-16 15:19 东人EP 阅读(450) | 评论 (0)编辑 收藏


posted @ 2006-08-16 15:17 东人EP 阅读(139) | 评论 (0)编辑 收藏

仅列出标题
共8页: 1 2 3 4 5 6 7 8