当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 如果我想让系统自动记录本次登录的用户名,以便下次登录的时候不用再次输入,应该怎么做?我知道可以用 setprofilestring()函数将用户名写到ini文件中,然后用 profilestring()函数读出来,但应该怎么把用户名写到ini文件去呢? ......
 ·informix跟sql,access比较怎么样    »显示摘要«
    摘要: informix以前从来没听说过,只知道access,sql,oracle 他在速度和其他一些方面和sql,access比较怎么样? 他的运行方式和sql server差不多吗? 还有,我们现在内部网上有一个vb+informix的软件,但是功能极不完善,想破解他直接连数据库服务器。有什么办法? ......


datagrid编辑是出现“指定的转换无效”的错误

在点datagrid的编辑的时候出现“指定的转换无效”的错误:Dim   projectid   As   String   =   CType(e.Item.Cells(3).Controls(0),   TextBox).Text  
  请各位帮帮忙,急啊!!!!!!!!!!!!!!  
   
  --------------源码------  
  Sub   dgResult_UpdateCommand(ByVal   sender   As   Object,   ByVal   e   As   DataGridCommandEventArgs)   Handles   dgResult.UpdateCommand  
                  Dim   intID   As   Integer   =   dgResult.DataKeys(e.Item.ItemIndex)  
                  Dim   projectid   As   String   =   CType(e.Item.Cells(3).Controls(0),   TextBox).Text  
   
                  Dim   myCommand   As   SqlCommand  
   
                  strSql   =   "UPDATE   Project   Set   projectid=@projectid   WHERE   id="   &   intID   &   ""  
   
                  myCommand.Parameters.Add(New   SqlParameter("@projectid",   SqlDbType.VarChar,   10))  
                  myCommand.Parameters("@projectid").Value   =   projectid  
   
                  myCommand   =   New   SqlCommand(strSql,   myConnection)  
                  myConnection.Open()  
                  Try  
                          myCommand.ExecuteNonQuery()  
                          dgResult.EditItemIndex   =   -1  
                  Catch   ex   As   SqlException  
                          If   ex.Number   =   2627   Then  
                                  lblErrorMessage.Visible   =   True  
                                  lblErrorMessage.Text   =   "数据库中已经存在相同的项目标识!"  
                          Else  
                                  lblErrorMessage.Visible   =   True  
                                  lblErrorMessage.Text   =   "不能更新记录!"  
                          End   If  
                  End   Try  
                  myConnection.Close()  
                  BindData()  
   
 

NO.1   作者: zhangzs8896

试试  
  Dim   projectid   As   String   =   (CType(e.Item.Cells(3).Controls(0),   TextBox)).Text  
 

NO.2   作者: ghchen

你的dataGrid的Item.Cells(3).Controls(0不是TextBox

NO.3   作者: renyu732

这样做试试:  
  将Dim   projectid   As   String   =   CType(e.Item.Cells(3).Controls(0),   TextBox).Text  
  改为  
  Dim   projectText   as   TextBox=Ctype(e.Item.Cells(3).Controls(0),TextBox)  
  然后  
  Dim   Projectid   as   String=projectText.Text

NO.4   作者: renyu732

如果还不成,那应该就是  
  e.Item.Cells(3).Controls(0)  
  的问题了.  
   
  你可以将这个输入看看是什么...


    摘要: 假如用wwtable控件联结到一个表,该表的字段名为(field1,field2,field3) 在wwtable中将各字段的displaylabel设置为(编号,姓名,性别) 请教如何用一个 function getfieldname(物理字段名): 逻辑字段名 ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE