.net学习笔记–一次小的失误

Posted by 风中客 @ 10:53 am, 03月 19th, 2006

很长时间没更新了
太忙了
忙着找工作了
最近又接了一个活,做一个在线的调查问卷
在其中遇到一些问题,总结一下

1.AutoPostBack问题
我原来有个想法就是,通过checkbox的选否控制一个radiobutton的enabled与否,将checkbox的autopostback设为True之后,每次点选checkox均跳出javascript错误

前页的脚本发生错误
错误:对象不支持此属性或方法
是否继续在该页面上运行脚本?

以前也写过类似的,没发生过这种错误阿。在CSDN提问没人理,论坛网站转了不少,也没发现结果。最后在一个blog上找到结果,他也跟我犯了同样的错误,就是表单提交按钮的ID设为Submit了。改了ID后成功了!

2.AutopostBack丢失焦点问题(Lost Focus)

当AutopostBack后就重新刷新,焦点丢失了
如何将焦点固定在某一个控件呢?
发现如下代码:
 Private Sub SetFocus(ByVal ctrl As Control)
        ‘ Define the JavaScript function for the specified control.
        Dim focusScript As String = "<script language=’javascript’>document.getElementById(‘" + ctrl.ClientID + "’).focus();</script>"

        ‘ Add the JavaScript code to the page.
        Page.RegisterStartupScript("FocusScript", focusScript)
    End Sub

在应用中直接 SetFocus(控件ID)即可
很方便!

.NET 中 导入/导出 Excel 或者 CSV文件

Posted by 风中客 @ 5:20 pm, 12月 27th, 2004

转贴自http://www.donews.net/lealting/archive/2004/12/27/217471.aspx

如何在.NET中汇出Excel或者CSV文件,基本上比较经济的做法不是使用Excel工具,而是使用.NET的Response的ContentType属性来设置实现。

例一,通过XML和XSL进行汇出

例二,通过将DataSet转换为文本进行汇出

导入CSV文件,用ADO.NET的OleDB Provider .

   StringBuilder sDBCon = new StringBuilder(“Provider=Microsoft.Jet.OLEDB.4.0;”);
   sDBCon.Append(“Data Source=”);
   sDBCon.Append(sFileDirectory); //这里设置为上传文件所在的目录
   sDBCon.Append(“;Extended Properties=Text;”); //处理的是文本类型

   String sSelect = “select * from  “+ sFileName;  //表明被文件名所代替
   try
   {   
    OleDbDataAdapter da = new OleDbDataAdapter(sSelect,sDBCon.ToString());
    _dsTrans = new DataSet();
    da.TableMappings.Add(“Table”, “ExcelTest”);
    da.Fill(_dsTrans);
   }
   catch
   {
    this.MessageBox(“读取您上传的文件的时候发生了错误,请确认您上传的文件是否正确。”);
    return;
   }

.net winform 学习笔记—数据库备份工具

Posted by 风中客 @ 2:54 pm, 11月 13th, 2004

private void ButtonBackUp_Click(object sender, System.EventArgs e)
        {
           
this.Cursor = Cursors.WaitCursor;
           
string _DBServ = Btnback1.Text;
           
string _DBName = Btnback2.Text;
           
string _DBUser = Btnback3.Text;
           
string _DBPass = Btnback4.Text;
           
           
string m_ConnectionStr   = data source=+_DBServ+;initial catalog=master;user id=+_DBUser+;pwd=+_DBPass+;Connect Timeout=5;;
            SqlConnection _Conn
= new SqlConnection(m_ConnectionStr);           
           
try
            {
                _Conn.Open();
                SaveFileDialog _SaveFileDialog
= new SaveFileDialog();         //保存的文件目录路径      
                _SaveFileDialog.Title = 请选择备份保存的目录;
                _SaveFileDialog.Filter
=(*.Bak)|*.Bak;|(All Files)|*.*;
               
if(_SaveFileDialog.ShowDialog()==DialogResult.OK)
                {
                     
                   
string _FolderPath = _SaveFileDialog.FileName;                                          
                   
                    SqlCommand _Comm
= new SqlCommand(“”,_Conn);
                   
//执行数据库备份命令
                   
//_Comm.CommandText = “BACKUP DATABASE “+_DBName+” TO DISK = “+ _FolderPath +” “;
                    _Comm.CommandText = BACKUP DATABASE +_DBName+ TO DISK = ‘+ _FolderPath +;
                    _Comm.ExecuteNonQuery();                   
                   
this.Cursor = Cursors.Arrow;
                    _Conn.Close();
                    MessageBox.Show(
备份数据成功!,提示,MessageBoxButtons.OK,MessageBoxIcon.Information);
                }
               
this.Cursor = Cursors.Arrow;

            }
           
catch(System.Exception error)
            {
               
this.Cursor = Cursors.Arrow;
                MessageBox.Show(
异常:+error.Message,提示,MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
           
this.Cursor = Cursors.Arrow;
        }

       
private void buttonXP1_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog _OpenFileDialog
= new OpenFileDialog();
            _OpenFileDialog.Title
=请选择文件恢复;
            _OpenFileDialog.Filter
=(*.Bak)|*.Bak;|(All Files)|*.*;
           
if (_OpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                BtnRestory.Text
=_OpenFileDialog.FileName;
            }
        }

       
private void ButtonRestory_Click(object sender, System.EventArgs e)
        {
           
if(MessageBox.Show(该操作将数据覆盖!!\n\n如果选择[是],将原来的数据覆盖\n\n如果选择[否],将取消恢复,提示,MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.No)
               
return;
           
if(MessageBox.Show(请再次确认,该操作不能恢复!!\n\n如果选择[是],将原来的数据覆盖\n\n如果选择[否],将取消恢复,提示,MessageBoxButtons.YesNo,MessageBoxIcon.Warning)==DialogResult.No)
               
return;
           
this.Cursor = Cursors.WaitCursor;

           
string _DBServ = R1.Text;
           
string _DBName = R2.Text;
           
string _DBUser = R3.Text;
           
string _DBPass = R4.Text;

           
string m_ConnectionStr   = data source=+_DBServ+;initial catalog=master;user id=+_DBUser+;pwd=+_DBPass+;Connect Timeout=5;;
            SqlConnection _Conn
= new SqlConnection(m_ConnectionStr);           
           
try
            {
                _Conn.Open(); 
               
//SqlCommand _Comm = new SqlCommand(“restore filelistonly from disk=’”+_FolderPath+@”\”+_DBName+@”.bak’”,_Conn);//获得原来的逻辑名称以及物理路径
                string _FolderPath=d:;
               
string _DBPath = ces;
                SqlCommand _Comm
= new SqlCommand(restore filelistonly from disk=’+_FolderPath+@”\+_DBPath+@”.bak’,_Conn);//获得原来的逻辑名称以及物理路径
                SqlDataReader _Reader = null;
                _Reader
= _Comm.ExecuteReader();
               
string[]  _LogName = new string[2];//获得逻辑名称
                string[]  _PhiPath = new string[2];//获得物理路径
                int j = 0;
               
while(_Reader.Read())
                {
                    _LogName[j]
= (string)_Reader.GetValue(0);
                    _PhiPath[j]
= (string)_Reader.GetValue(1);
                    j
= j+1;
                }
                _Reader.Close();
                MessageBox.Show(_LogName[
0]);
                       
               
//执行数据库恢复脚本
                _Comm = new SqlCommand(“”,_Conn);
                _Comm.CommandText
=RESTORE DATABASE [" + _DBName + "]   FROM DISK = ‘ + BtnRestory.Text + ‘ With Move ‘+ _LogName[0] +
                   
‘ TO ‘ +_PhiPath[0]+ ‘,  Move ‘ + _LogName[1] + ‘ TO ‘ + _PhiPath[1]+ ;
                _Comm.ExecuteNonQuery();                   
                           
               
this.Cursor = Cursors.Arrow;
                MessageBox.Show(
数据恢复成功!,提示,MessageBoxButtons.OK,MessageBoxIcon.Information);
                _Conn.Close();
                      
               
this.Cursor = Cursors.Arrow;

            }
           
catch(System.Exception error)
            {
               
this.Cursor = Cursors.Arrow;
                MessageBox.Show(
异常:+error.Message,错误,MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }

.net Winform 学习笔记

Posted by 风中客 @ 2:44 pm, 11月 13th, 2004

 

1,MDI窗体
设有两个窗体frmMain,frmChild,则:
frmMain:  设IsMdiContainer属性为true
 打开子窗口:
  在相关事件中写如下代码:
  frmChild child=new frmChild();
  child.MdiParent=this;//this表示本窗体为其父窗体
  child.Show();
  在打开子窗体时,如果只允许有一个子窗体,可以加入如下判断:
  if (this.ActiveMdiChild!=null)
  {
     this.ActiveMdiChild.Close(); //关闭已经打开的子窗体
     //….
  }
更改MDI主窗体背景
 先声明一个窗体对象
 private System.Windows.Forms.MdiClient m_MdiClient;
 在Form_Load等事件中,添加如下代码:
 int iCnt=this.Controls.Count;
 for(int i=0;i<iCnt;i++)
 {
 if(this.Controls[i].GetType().ToString()==”System.Windows.Forms.MdiClient”)
 {
  this.m_MdiClient=(System.Windows.Forms.MdiClient)this.Controls[i];
  break;
 }
  }
 this.m_MdiClient.BackColor=System.Drawing.Color.Silver;
 具体可参见:http://cnblogs.com/Daview/archive/2004/05/06/8381.aspx


2,创建系统托盘菜单
  2.1,创建一个contextMenu(cmnMain)菜单
  2.2,添加一个NotifyIcon组件,设置ContextMenu属性为cmnMain
  2.3,相应窗体改变事件(最小化等)
   private void frmMain_SizeChanged(object sender,EventArgs e)
   {
      if (this.WindowState==FormWindowState.Minimized)
      {
         this.Hide();
         noiMain.Visible=true;
      }
   }


  2.4,相应用户单击系统托盘上contextmenu菜单事件
  private void mniOpen(object sender,EventArgs e)
  {
      noiMain.Visible=false;
      this.Show();
      this.Focus();
  }


  2.5,响应用户双击系统托盘图标事件
  private void noiMain_DoubleClick(object s,EventArgs e)
  {
      minOpen.PerformClick(); //相当与mniOpen按钮的单击事件
  }
  **注意添加相应的事件句柄**


3,创建不规则窗体
 3.1,在窗体上创建不规则图象,可以用gdi+绘制,或在图象控件上使用图象填充
 3.2,设置窗体的backcolor为colorA,然后设置TransparencyKey为colorA
 3.3,设置FormBorderStyle为none;


4,创建顶部窗体
  this.TopMost=true;//把窗体的TopMost设置为true



5,调用外部程序


  using System.Diagnostics


  Process proc=new Process();
  proc.StartInfo.FileName=@”notepad.exe“;  //注意路径
  proc.StartInfo.Arguments=”";
  proc.Start();


//获得当前目录Directory.GetCurrentDirectory() (using System.IO)


6,Toolbar的使用
  Toolbar控件通常需要imagelist控件结合使用(需要用到其中图标)
  响应Toolbar单击事件处理程序代码:
  switch(ToolbarName.Buttons.IndexOf(e.Button))
  {
      case 0:   //第一个按钮
          //code …
          break;
      case 1:   //第二个按钮
          //code …
          break;
      //other case code
      default:  //默认处理,但以上所有项都不符合时
          //code …
          break;
  }


7,弹出对话框获得相关返回值
  在窗体的closing事件中运行如下代码,可以在用户关闭窗体时询问
  DialogResult result=MessageBox.Show(this,”真的要关闭该窗口吗?”,”关闭提示”,MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
  if (result==DialogResult.OK)
  {
  //关闭窗口
  e.Cancel=false;
  }
  else
  {
  //取消关闭
  e.Cancel=true;
  }


8,打印控件
  最少需要两个控件
  PrintDocument
  PrintPreviewDialog:预览对话框,需要printdocument配合使用,即设置document属性为
                     对应的printDocument
  printdocument的printpage事件(打印或预览事件处理程序)代码,必须.


 float fltHeight=0;
 float fltLinePerPage=0;
 long lngTopMargin=e.MarginBounds.Top;
 int intCount=0;
 string strLine;


 //计算每页可容纳的行数,以决定何时换页
 fltLinePerPage=e.MarginBounds.Height/txtPrintText.Font.GetHeight(e.Graphics);


   
 while(((strLine=StreamToPrint.ReadLine()) != null) && (intCount<fltLinePerPage))
 {
    intCount+=1;
    fltHeight=lngTopMargin+(intCount*txtPrintText.Font.GetHeight(e.Graphics));
    e.Graphics.DrawString(strLine,txtPrintText.Font,Brushes.Green,e.MarginBounds.Left,fltHeight,new StringFormat());
 }


 //决定是否要换页
 if (strLine!=null)
 {
    e.HasMorePages=true;
 }
 else
 {
    e.HasMorePages=false;
 }
  以上代码的StreamToPrint需要声明为窗体级变量:
  private System.IO.StringReader StreamToPrint;


  打开预览对话框代码(不要写在printpage事件中)
  StreamToPrint=new System.IO.StringReader(txtPrintText.Text);
  PrintPreviewDialogName.ShowDialog();


9,string对象本质与StringBuilder类,字符串使用
string对象是不可改变的类型,当我们对一个string对象修改后将会产生一个新的string对
象,因此在需要经常更改的字符对象时,建议使用StringBuilder类:
[范例代码]构造一个查询字符串
StringBuilder sb=new StringBuilder(“”);
sb.Append(“Select * from Employees where “);
sb.Append(“id={0} and “);
sb.Append(“title=”{1}””);
String cmd=sb.ToString();


sb=null; //在不再需要时清空它


cmd=String.Format(cmd,txtId.Text,txtTile.Text); //用实际的值填充格式项


判断字符串是否为空:
检查一个字符串是否为空或不是一个基本的编程需要,一个有效的方法是使用string类的Length属性来取代使用null或与”"比较。


比较字符串:使用String.Equals方法来比较两个字符串
string str1=”yourtext”;
if (str1.Equals(“TestSting”) )
{
  // do something
}


10,判断某个字符串是否在另一个字符串(数组)中
 需要用到的几个方法
 string.Split(char);//按照char进行拆分,返回字符串数组
 Array.IndexOf(Array,string):返回指定string在array中的第一个匹配项的下标
 Array.LastIndexOf(Array,string):返回指定string在array中的最后一个匹配项的下标
 如果没有匹配项,则返回-1
 [示例代码]:
 string strNum=”001,003,005,008″;
 string[] strArray=strNum.Split(”,”);//按逗号拆分,拆分字符为char或char数组
 
 Console.WriteLine(Array.IndexOf(strArray,”004″).ToString());


11,DataGrid与表和列的映射
从数据库读取数据绑定到DataGrid后,DataGrid的列标头通常跟数据库的字段名相同,如果
不希望这样,那么可以使用表和列的映射技术:
using System.Data.Common;


string strSql=”select * from Department”;
OleDbDataAdapter adapter=new OleDbDataAdapter(strSql,conn);


DataTableMapping dtmDep=adapter.TableMappings.Add(“Department”,”部门表”);


dtmDep.ColumnMappings.Add(“Dep_Id”,”部门编号”);
dtmDep.ColumnMappings.Add(“Dep_Name”,”部门名称”);


DataSet ds=new DataSet();


adapter.Fill(ds,”Department”); //此处不能用”部门表”


响应单击事件(datagrid的CurrentCellChanged事件)
DataGridName.CurrentCell.ColumnNumber;//所单击列的下标,从0开始,下同
DataGridName.CurrentCell.RowNumber;//所单击行的下标
DataGridName[DataGridName.CurrentCell];//所单击行和列的值


DataGridName[DataGridName.CurrentRowIndex,n].ToString();//获得单击行第n+1列的值


12,动态添加菜单并为其添加响应事件
 添加顶级菜单:
 MainMenuName.MenuItems.Add(“顶级菜单一”);//每添加一个将自动排在后面


 添加次级菜单:
 MenuItem mniItemN=new MenuItem(“MenuItemText”)
 MenuItem mniItemN=new MenuItem(“MenuItemText”,new EventHandler(EventDealName))
 MainMenuName.MenuItems[n].MenuItems.Add(mniItemN);//n为要添加到的顶级菜单下标,从0开始


 创建好菜单后添加事件:
 mniItemN.Click+=new EventHandler(EventDealName);


 也可以在添加菜单的同时添加事件:
 MenuItem mniItemN=new MenuItem(“MenuItemText”,new EventHandler(EventDealName));
 MainMenuName.MenuItems[n].MenuItems.Add(mniItemN);


13,正则表达式简单应用(匹配,替换,拆分)
 using System.Text.RegularExpressions;


 //匹配的例子
 string strRegexText=”你的号码是:020-32234102″;
 string filter=@”\d{3}-\d*”;


 Regex regex=new Regex(filter);
 Match match=regex.Match(strRegexText);


 if (match.Success) //判断是否有匹配项
 {
     Console.WriteLine(“匹配项的长度:”+match.Length.ToString());
     Console.WriteLine(“匹配项的字符串:”+match.ToString());
     Console.WriteLine(“匹配项在原字符串中的第一个字符下标:”+match.Index.ToString());
 }
 
 //替换的例子
 string replacedText=regex.Replace(strRegexText,”020-88888888″);
 Console.WriteLine(replacedText);//输出”你的号码是:020-88888888″


 //拆分的例子
 string strSplitText=”甲020-32654已020-35648丙020-365984″;
 foreach(string s in regex.Split(strSplitText))
 {
    Console.WriteLine(s); //依次输出”甲乙丙”
 }


13,多线程简单编程
 using System.Threading;


 Thread ThreadTest=new Thread(new ThreadStart(ThreadCompute));
 ThreadTest.Start();//使用另一个线程运行方法ThreadCompute
 
 ThreadCompute方法原型:
 private void ThreadCompute()
 {}

14,操作注册表
using System.Diagnostics;
using Microsoft.Win32;
  //操作注册表
  RegistryKey RegKey=Registry.LocalMachine.OpenSubKey(“Software”,true);


  //添加一个子键并给他添加键值对
  RegistryKey NewKey=RegKey.CreateSubKey(“regNewKey”);
  NewKey.SetValue(“KeyName1″,”KeyValue1″);
  NewKey.SetValue(“KeyName2″,”KeyValue2″);


  //获取新添加的值
  MessageBox.Show(NewKey.GetValue(“KeyName1″).ToString());


  //删除一个键值(对)
  NewKey.DeleteValue(“KeyName1″);


  //删除整个子键
  RegKey.DeleteSubKey(“regNewKey”);

今日.Net学习笔记—-数据库连接字符串的设置

Posted by 风中客 @ 12:49 pm, 04月 15th, 2004

            今天我将我原来做的论坛所有数据库的连接字符串给换了。原来的连接字符串是在VS.NET中添加connection时自动设置的。这回我要手动了。总结起来看到的连接字符串的设置有这么几种方法。



  • 简单方便。
    在VS.net中直接从数据选项卡中添加oledb(sql)connection。就可以了

  • 在程序中根据不同情况可采用以下的方法。


  1. 程序中用1
     Dim conn As OleDb.OleDbConnectio
     Dim connstr As String
     constr=“Provider=Microsoft.Jet.OLEDB.4.0;data source=f:\ioffice\dbdb\global.mdb“

     conn =new ole.oledbconnection(concstr)

  2. 程序中2
     Dim conn As OleDb.OleDbConnectio
     Dim connstr As String
     constr=“Provider=Microsoft.Jet.OLEDB.4.0;data source
    =“+server.mappath(“.“+“\dbdb\global.mdb“)
     conn =new ole.oledbconnection(concstr)

  3. 程序中3,添加System.I/O
     Dim conn As OleDb.OleDbConnection
     Dim sr As StreamReader
     Dim str As String
     str = Server.MapPath(“config.txt“)
     sr = File.OpenText(str)
     Dim constr As String
     constr = sr.ReadLine
     conn = New OleDb.OleDbConnection(constr)
    在程序根目录下有一个config.txt的文本文件。文本文件内容如下:

  4. 程序中4,使用web.config存储数据库连接字符串
    在web.config中添加键值。
    <appSetting>
         <add Key=“constring“
                  value=“Provider=Microsoft.Jet.OLEDB.4.0;data source=f:\ioffice\dbdb\global.mdb“/>
    </appSetting>
      注意大小写。在程序中添加 
     Dim conn As OleDb.OleDbConnectio
     Dim connstr As String
     constr=configurationsetting.appsettings(“constring“)
     conn =new ole.oledbconnection(concstr)

今日.NET Web service学习笔记—发布与测试

Posted by 风中客 @ 1:22 pm, 04月 13th, 2004
  1. Web Service的发布 
    首先把web  reference  该为动态(把URL  Behavior  设成  Dynamic)然后在app.config(B/s 是web.Config)中生成appSettings,把它里面的value  的URL  改成新的地址  。
  2. 如何在其他机器上测试Web Service.
    web.config文件里,添加同级的如下节点就可以了
     <webServices>
      <protocols>
       <add name="HttpPost" />
       <add name="HttpGet" />
      </protocols>
       </webServices>
    默认情况下webServices只支持SOAP调用,加上上面的语句后就支持HttpPost和HttpGet的调用了

 

今日.NET Web Service学习笔记—-小试牛刀

Posted by 风中客 @ 12:24 pm, 04月 13th, 2004

    从今天开始我就要开始学习 Web Service了。以前都是作ASP.net,从来没接触过Web Service,只是在我那本《ASP.NET技术内幕》中,有对Web Service的介绍,看的时候也是很盲目,因为重来没有做过也没有例子看过,所以觉得Web Service学起来一定很困难。我就在网上四处转悠,看了不少的资料。下面就是我这些天看的东东

  1. Web Service学习笔记之—-JAX-RPC    starchu1981(原作)
  2. Support WebCast: Implementing and Accessing Web Services Using Visual Basic 6.0 and the SOAP Toolkit for Visual Studio 
  3. 《ASP.NET技术内幕》—-机械工业出版社
  4. .NET技术构建的旅游网全站(亚洲高校软件设计作品)

 

今日.Net学习笔记—-Microsoft.Web.UI.WebControls

Posted by 风中客 @ 6:33 pm, 04月 6th, 2004

     今天终于作完了学校的财务系统,忙碌了这么多日子,总算完工了。嘻嘻!


      虽然在我这大功告成,可是还没有给他安装。于是,带着我的程序就直奔财务处了。到了财务处,出问题了。
 


“/tijmucaiwu”应用程序中的服务器错误。



分析器错误


说明: 在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。

分析器错误信息: 找不到文件或程序集名称“Microsoft.Web.UI.WebControls”,或找不到它的一个依赖项。

源错误:





行 1:  <%@ register tagprefix=”zhenkai” tagname=”title” src=”title.ascx”%>
行 2: <%@ Register TagPrefix=”iewc” Namespace=”Microsoft.Web.UI.WebControls” Assembly=”Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ %>
行 3: <%@ Register TagPrefix=”ftb” Namespace=”FreeTextBoxControls” Assembly=”FreeTextBox” %>
行 4: <%@ Page Language=”vb” AutoEventWireup=”false” Codebehind=”admin.aspx.vb” Inherits=”tijmucw.admin”%>

源文件: F:\tijmucaiwu\admin.aspx    行: 2

程序集加载跟踪: 下列信息有助于确定程序集“Microsoft.Web.UI.WebControls”无法加载的原因。





=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///F:/tijmucaiwu
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===

LOG: Publisher policy file is not found.
LOG: No redirect found in host configuration file (D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet.config).
LOG: Using machine configuration file from D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config.
LOG: Post-policy reference: Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///D:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/tijmucaiwu/a315d8fb/2b695422/Microsoft.Web.UI.WebControls.DLL.
LOG: Attempting download of new URL file:///D:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/tijmucaiwu/a315d8fb/2b695422/Microsoft.Web.UI.WebControls/Microsoft.Web.UI.WebControls.DLL.
LOG: Attempting download of new URL file:///F:/tijmucaiwu/bin/Microsoft.Web.UI.WebControls.DLL.
LOG: Attempting download of new URL file:///F:/tijmucaiwu/bin/Microsoft.Web.UI.WebControls/Microsoft.Web.UI.WebControls.DLL.
LOG: Attempting download of new URL file:///D:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/tijmucaiwu/a315d8fb/2b695422/Microsoft.Web.UI.WebControls.EXE.
LOG: Attempting download of new URL file:///D:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/tijmucaiwu/a315d8fb/2b695422/Microsoft.Web.UI.WebControls/Microsoft.Web.UI.WebControls.EXE.
LOG: Attempting download of new URL file:///F:/tijmucaiwu/bin/Microsoft.Web.UI.WebControls.EXE.
LOG: Attempting download of new URL file:///F:/tijmucaiwu/bin/Microsoft.Web.UI.WebControls/Microsoft.Web.UI.WebControls.EXE.




版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573


我想可能是Microsoft.Web.UI.WebControls.dll没给他copy到/bin目录下,于是我又跑回我的工作室,找当初的安装程序,说什么也找不到了,于是上了MSDN找到了可以下载的IEwebcontrols.msi眼巴巴的看着下载滚动条走到尽头,试也没试就直接去财务处了。没想到那个安装程序是Microsoft.Web.UI.WebControls的源程序,还需要自己


To build the IE Web Controls:


1.  Make sure you have installed the .NET Framework SDK v1.0 or v1.1
2.  Run Build.bat, which will create a build folder in this directory. 
    The build folder contains Microsoft.Web.UI.WebControls.dll and a
    Runtime directory of supporting files.


To run the IE Web Controls:


1.  Copy the contents of the Runtime directory to the webctrl_client\1_0
    directory under your top-level site directory.  For example, if your
    site root is c:\Inetpub\wwwroot, type this at the command prompt:


    xcopy /s /i .\build\Runtime c:\Inetpub\wwwroot\webctrl_client\1_0 /y


    This will create the following directory structure under the site:


      /webctrl_client/1_0
        MultiPage.htc
        TabStrip.htc
        toolbar.htc
        treeview.htc
        webservice.htc
        webserviced.htc
        [images]
        [treeimages]


以上摘自安装程序的readme.txt。郁闷的我,又自己试验了很多次,得到了很多种报错,总之就是不行。难道还要和上回一样吗?上回在WINxp下运行不了.Net,于是一狠心装了WIN server 2003,这回可怎么办!!!我自己走回工作室,翻来覆去得找我原来的安装文件,我记得当初用的时候,一路NEXT就搞定了,怎么一到别人那就不行呢?


最后,在一个不起眼的地方找到一个Tree.msi的文件,看其属性赫然写着“Microsoft Internet Explorer WebControls for ASP .NET.”,哎!就是他了。看来还是原来的东西好呀,到财物那装上后,搞定!!!


今日.Net学习笔记—–page.ispostback 和datareader

Posted by 风中客 @ 10:28 pm, 04月 2nd, 2004

最近太忙


两个问题



  1. 绑定数据时一定要验证page.ispostback

  2. 不为什么今天datareader不好用,只能dataset

修复.Net框架的几种方法

Posted by 风中客 @ 3:22 pm, 03月 26th, 2004

修复 .NET 框架



  • 插入 Visual Studio .NET 光盘并运行
    <DVD Drive>:\wcu\dotNetFramework\dotnetfx.exe /t:c:\temp /c:”msiexec.exe /fvecms c:\temp\netfx.msi”

  • 插入 Visual Studio .NET Windows 组件更新光盘并运行
    <CD Drive>:\dotNetFramework\ dotnetfx.exe /t:c:\temp /c:”msiexec.exe /fvecms c:\temp\netfx.msi”

  • 在Visual Studio .NET 2003 命令行窗口下运行aspnet_regiis.exe -i