机房收费系统(2)--神奇的txtSQL和MsgText

今天我要给大家介绍的是我们在学生信息管理系统和机房收费系统中经常见到的两个个自定义函数txtSQL和MsgText。相信大家对它都不陌生,因为在机房收费系统中用到它的几率太大了,只要存在调用数据库的事件发生就会用到它。

   Dim txtSQL As String
   Dim MsgText As String
       txtSQL = "select * from checkweek_Info where date between'" & datestar & "' and '" & dateend & "'"
       Set mrc = ExecuteSQL(txtSQL, MsgText)
在现在的机房系统中我们经常会遇到一个错误类型就是它(下图),而假如我们不知该从何下手去调错的话,不妨先把我们的鼠标放在msgtext上,看看我们的错误原因,然后再把鼠标放在txtSQL上,它会提示我们在哪句上出现了错误,这个时候我们就要仔细得找找这句话当中的错误,在这里给大家提供几个错误原因供大家参考:

1、数据库连接出现了问题,在做项目的前期中一定要把数据库连接正确

2、仔仔细细的检查一下我们代码中是否出现了“空格”的错误,多或少的问题,例如:txtSQL=“select * from student_info wherecardno=”

3、打开SQL Server检查一下数据库中表的名字是否跟自己写的一样

还有在这里提醒大家,在敲代码的时候一定要仔细认真,个人观点:敲窗体要敲完一个调一个,别等着敲完全部在下手挑错。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 23
    评论
TXTSQL是一种文本数据库,文件存储方式类似mysql,兼容部分sql语句.   PHP需4.0以上版本才能运行。   官方网站:http://txtsql.com/ txtSQL简单例子(来源:http://smvcn.xhblog.com/archives/2007/259845.shtml)   <?php   include('./txtSQL.class.php');   $sql = new txtSQL('./data');   $sql->connect('root', 'bar');   /*创建数据库   $sql->createdb(array('db' => 'demo')) or die('Error creating txtSQL DB, txtSQL said: '.$sql->get_last_error());   */   /*选择数据库*/   $sql->selectdb ( 'demo' );   /*创建表   $columns = array('id' => array('type' => 'int', 'auto_increment' => 1, 'permanent' => 1 ),   'name' => array('type' => 'string', 'max' => 50),   'email' => array('type' => 'string', 'max' => 50)   );   foreach($columns as $k => $v){   echo "\$colums[$k]=";   foreach($v as $k1 => $v1){   echo "$k1:$v1 ";   }   echo "<br>";   }   $sql->execute('create table',array(   'table' => 'table1',   'columns' => $columns)) or die('建表发生错误:'.$sql->get_last_error());   if($sql->table_exists('table1','demo')){   echo "建表成功";   }else{   echo "建表失败";   }   */   /*插入纪录   $value = array(0 => array('name' => 'abc','email' => 'abc@123.com'),   1 => array('name' => '123','email' => '123@bac.com'),   2 => array('name' => 'df','email' => 'reg@bac.com'),   3 => array('name' => 'trt','email' => 'hgh@bac.com'),   4 => array('name' => 'tyty','email' => 'ytyt@bac.com')   );   for($i=0;$i<5;$i++){   echo "\$value[$i]:";   foreach($value[$i] as $k => $v){   echo "[$k]=$v ";   }   echo "<br>";   }   for($i=0;$i<5;$i++){   if(!$sql->execute('insert',array('table' => 'table1','values' => $value[$i] ))){   die('An error occurred, txtSQL said: '.$sql->get_last_error());   }else{   echo "插入成功<br>";   }   }   */   /*修改表数据   $value = array('name' => 'abc','email' => 'aaa@123.com');   if(!$sql->execute('update',array('table' => 'table1','where' => array('id = 1'),'values' => $value))){   die('An error occurred, txtSQL said: '.$sql->get_last_error());   }else{   echo "修改成功";   }   */   /*删除表内容   $delete = array('table' => 'table1','where' => array('id > 1'));   $delcount = $sql->execute('delete',$delete);   echo $delcount;   */   /*显示表内容*/   $select = array('table' => 'table1','orderby' => array('id','asc')/*,'where' => array('email =~ %bac%'),'limit' => array(0,9)*/);   $data = $sql->execute('select',$select);   echo "<table border=1><tr><th>id</th><th>name</th><th>email</th></tr>";   foreach ( $data as $key => $row )   {   echo "<tr>";   foreach($row as $k => $v){   echo "<td>$v</td>";   }   echo "</tr>";   }   echo "</table>";   echo "表内共有 ".$sql->table_count('table1')." 行<BR>";   /*加入主键   $sql->execute('alter table',array('table' => 'table1','action' => 'addkey','name' => 'id','values' => array('name' => 'id')));   */   echo "最后插入ID号:".$sql->last_insert_id('table1') ;   $sql->disconnect();   ?>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 23
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值