CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  ASP.NET

问一个数组的问题和问一个代码共享的问题

楼主weki(小李)2003-09-04 09:54:20 在 .NET技术 / ASP.NET 提问

问题一:数据库里面存放怎样的数据更容易放在数组里呢,我的是Access数据库的文本字段,存成         8,22,32,48,       这样的,但是这样放进数组里会出错。怎样做可以直接放入数组里面呢?  
   
   
  问题二:新建一个项目,写了个config.cs   ,在config.cs里面作了个连接数据库的   ConnDB.Open();我现在又新建了一个目录为Forum,在Forum里面有个default.aspx,问题就是在default.aspx里面怎样调用这个上一级目录的ConnDB.Open();呀。同一目录就可以,但是不同目录会出错的,要怎样做? 问题点数:100、回复次数:6Top

1 楼saucer(思归)回复于 2003-09-04 09:58:23 得分 0

1.    
  YourArrayTable  
  Array_ID   number  
  Array_Value   number  
   
  1       8  
  1       22  
  1       32  
  1       48  
  2       1  
  2       3  
  2       4  
   
  2.   compile   config.cs   into   a   dll   and   copy   it   to   the   bin   subdirectory   of   your   virtual   directory   and   call   it   freelyTop

2 楼saucer(思归)回复于 2003-09-04 10:02:21 得分 0

1.    
  YourArrayTable  
  Array_ID   number  
  Array_Value   number  
   
  1       8  
  1       22  
  1       32  
  1       48  
  2       1  
  2       3  
  2       4  
   
  2.   compile   config.cs   into   a   dll   and   copy   it   to   the   bin   subdirectory   of   your   virtual   directory   and   call   it   freelyTop

3 楼hgknight(江雨.net)回复于 2003-09-04 10:02:51 得分 5

1.你是怎么放的,出什么错  
   
  2.using   yourNameSpace;  
  实例化该类Top

4 楼saucer(思归)回复于 2003-09-04 10:04:33 得分 0

1.    
  YourArrayTable  
  Array_ID   number  
  Array_Value   number  
   
  1       8  
  1       22  
  1       32  
  1       48  
  2       1  
  2       3  
  2       4  
   
  2.   compile   config.cs   into   a   dll   and   copy   it   to   the   bin   subdirectory   of   your   virtual   directory   and   call   it   freelyTop

5 楼weki(小李)回复于 2003-09-04 10:07:47 得分 0

问题一的:  
  aaa="8,22,32,48,";//其实这里是读出一个字段值  
  int[]   MyArr=   new   int[aaa]   {int.Parse(aaa)};   //我试过的方法,但是有错。:(  
        for   (int   i=0;   i   <   MyArr.Length;   i++)  
              {  
  Response.Write(MyArr[   i   ]+"<br>");  
            }  
   
   
  问题二的:  
  能不能给个例子看看呀。我很是笨..........:(   学了net很久还是在游呀游的Top

6 楼coolpine(岁寒一友)回复于 2003-09-04 10:14:09 得分 5

对于第一个方法,你还是把四个数字分别存到数组里面吧  
  用过二维数组,或者数组的数组好了Top

7 楼saucer(思归)回复于 2003-09-04 10:15:22 得分 45

string   aaa="8,22,32,48,";  
  string[]   alist   =   aaa.Split(',');  
  int[]   MyArr   =   new   int[alist.Length];  
  for   (int   i=0;   i   <   MyArr.Length;   i++)  
  {  
    MyArr[i]   =   Int32.Parse(alist[i].Trim());  
    Response.Write(MyArr[i]+"<br>");  
  }  
  Top

8 楼chnking(kent)回复于 2003-09-04 10:26:35 得分 45

问题一的:  
  string   aa="8,22,32,48,";//其实这里是读出一个字段值  
  string[]   aaa   =   aa.Split(',');  
  for   (int   i=0;   i   <   aaa.Length;   i++)  
  {  
  Response.Write(aaa[i]+"<br>");  
  }  
   
  问题二:  
  写了个config.cs,其中有个config的类,这个类有些public的方法,比如这个类所在的名称控件为:WebApplication1。  
  又新建了一个目录为Forum,在Forum里面有个default.aspx,这个page的缺省名称空间是:WebApplication1.Forum,在default.aspx要引用上述的config的类,应该在文件头部引用config的类的名称空间:  
  using   WebApplication1;  
   
  然后实例化config类:  
  config   myconfig   =   new   config();  
   
  要是没有引用config类的名称空间可以这样声明config类:  
  WebApplication1.config   myconfig   =   new   WebApplication1.config();Top

9 楼chnking(kent)回复于 2003-09-04 10:27:23 得分 0

问题一的:  
  string   aa="8,22,32,48,";//其实这里是读出一个字段值  
  string[]   aaa   =   aa.Split(',');  
  for   (int   i=0;   i   <   aaa.Length;   i++)  
  {  
  Response.Write(aaa[i]+"<br>");  
  }  
   
  问题二:  
  写了个config.cs,其中有个config的类,这个类有些public的方法,比如这个类所在的名称控件为:WebApplication1。  
  又新建了一个目录为Forum,在Forum里面有个default.aspx,这个page的缺省名称空间是:WebApplication1.Forum,在default.aspx要引用上述的config的类,应该在文件头部引用config的类的名称空间:  
  using   WebApplication1;  
   
  然后实例化config类:  
  config   myconfig   =   new   config();  
   
  要是没有引用config类的名称空间可以这样声明config类:  
  WebApplication1.config   myconfig   =   new   WebApplication1.config();Top

相关问题

  • 代码共享,顺便提出一个问题,谢谢!
  • javascript和数组的问题
  • 动态数组和静态数组的一点疑问
  • 数组问题
  • 数组问题
  • 数组问题
  • 数组问题
  • 数组问题
  • 数组问题
  • 数组问题

关键词

  • 字段
  • 数据库
  • virtual
  • dll
  • 数组
  • yourarraytablearray
  • 问题
  • aaa
  • 目录
  • subdirectory

得分解答快速导航

  • 帖主:weki
  • hgknight
  • coolpine
  • saucer
  • chnking

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo