chocolate5215
著名写手
著名写手
  • 铜币9枚
  • 威望0点
  • 贡献值0点
阅读:1223回复:15

[紧急求助] Dreamweaver 中关于查询数据库的问题

楼主#
更多 发布于:2005-05-18 07:28
SQL老师的作业:

要求弄一个图书发行部门的应用程序。可以用VB来编,了网页的形式

数据库连接正确,里面的添加信息相关内容都正确,

到查询数据库内容的时候遇到问题。

我用“服务器行为”中的“记录集”创建一个记录,在新建了一个动态表格。

结果在IIS预览输入信息后没有显示数据!

请问DREAMWEAVER中如何进行设置数据库的查询和显示啊?

谢谢!



--------------------
[img]http://www.memail.net/images3/682771441632957957_71198.jpg[/img]
rover
写手
写手
  • 铜币4枚
  • 威望1点
  • 贡献值0点
1C#
发布于:2005-05-18 16:07
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
用asp直接写,比用dw好 --------------------
[img]http://www.mzb.com.cn/jiezhi.png[/img] [a]http://c921.blog.sohu.com/[/a]
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
2C#
发布于:2005-05-18 20:41
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
呵呵  你用DW啊~
我还傻呼呼的用VB.NET连接呢  
回头看看ASP.NET连接试试 -------------------- There are Pretenders among us.Geniuses with the ability to become anyone they want to be.
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
chocolate5215
著名写手
著名写手
  • 铜币9枚
  • 威望0点
  • 贡献值0点
3C#
发布于:2005-05-19 14:03
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
such 你作完了么 --------------------
[img]http://www.memail.net/images3/682771441632957957_71198.jpg[/img]
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
4C#
发布于:2005-05-19 15:48
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
Y老师不是让做界面么 呵呵
我还以为你早连接成功了呢~我也没成功~汗~

实在是懒得看现在~运筹准备开工呢~

PS:   不要叫我such
至少suchas~  thks
否则我叫你chok~~  呵呵 -------------------- There are Pretenders among us.Geniuses with the ability to become anyone they want to be.
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
0000
作家
作家
  • 铜币143枚
  • 威望34点
  • 贡献值1点
5C#
发布于:2005-05-19 22:55
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
直接寫嘛. --------------------            [a=http://northlight.digital-pulse.net/]寻找失落的路灯 @ North.Light[/a]
   有沒有事比死更容易? 有沒有事比活更難?
               ~     幸福是一雙溫暖的紅唇    ~
.--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
6C#
发布于:2005-05-20 08:15
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
定义一个class类吧~如果你用的是PHP+MYSQL,可以参考我的~
不过好麻烦  呵呵


\include\mysql.class.php

<?
// mysql连接类
// $DB=new DB_MYSQL;            // 加载类
// $DB->dbServer="localhost";   // 连接数据库地址
// $DB->dbUser="example";          // 用户名
// $DB->dbPwd="*******";               // 密码
// $DB->dbDatabase="test";        // 数据库名称
// $DB->connect();             // 连接数据库
// 使用中可以更改数据库
// 可以用到的函数说明
// query($sql,$dbbase);         // 可以直接执行
// query_first($sql,$dbbase);   // 查询返回只有一条记录,$sql为sql语句,$dbbase为你选者数据库(可以不要)
// insert,update,delete 皆为执行命令,其中可用$affected_rows;得到返回的数目
// 在insert时,可以用insert_id得到插入结果的返回id数
// count_records($table,$index,$where,$dbbase)// 为得到一个表记录的数目,$table为表名,$index为key,$where为条件,$dbbase为数据库,后两个可以不选
//####################### End Introduce ########################################

class DB_MYSQL          // 数据库mysql查询的类
{
  var $dbServer;        // 数据库连接服务地址
  var $dbDatabase;      // 所选择的数据库,初始状态
  var $dbbase="office";       // 后面可以改变的
  var $dbUser;          // 登陆用户名
  var $dbPwd;           // 登陆用户密码
  var $dbLink;          // 数据库连接指针
  var $query_id;        // 执行query命令的指针
  var $num_rows;        // 返回的条目数
  var $insert_id;       // 传回最后一次使用 INSERT 指令的 ID
  var $affected_rows;   // 传回query命令所影响的列数目
                  // INSERT、UPDATE 或 DELETE 所影响的列 (row) 数目。
                  // delete 如果不带where,那么则返回0

  function connect($dbbase="office")    // 连接数据库函数,包括连接数据库
        {
         global $userpconnect;   // 是否采用永久连接,$userpconnect在外部设置。
         if ($userpconnect==1){
                $this->dbLink=@mysql_pconnect($this->dbServer,$this->dbUser,$this->dbPwd);
                              } else {
                $this->dbLink=@mysql_connect($this->dbServer,$this->dbUser,$this->dbPwd);
                }
          if(!$this->dbLink) $this->halt("连接出错,无法连接!!!");
          if ($dbbase=="office") {
            $dbbase=$this->dbDatabase;
            }
        if(!mysql_select_db($dbbase, $this->dbLink))  // 连接数据库
                          { $this->halt("不能够用这个数据库,请检查这个数据库是否正确!!!");}
          }

  function change_db($dbbase="office"){ // 改变数据库
      $this->connect($dbbase);
      }

  function query_first($sql,$dbbase="office"){ // 返回一个值的sql命令
      $query_id=$this->query($sql,$dbbase);
        $returnarray=mysql_fetch_array($query_id);
        $this->num_rows=mysql_num_rows($query_id);
      $this->free_result($query_id);
      return $returnarray;
      }

  function delete($sql,$dbbase="office"){ // 删除命令
      $query_id=$this->query($sql,$dbbase);
      $this->affected_rows=mysql_affected_rows($this->dbLink);
      $this->free_result($query_id);
        }

  function insert($sql,$dbbase="office"){ // 插入命令
      $query_id=$this->query($sql,$dbbase);
      $this->insert_id=mysql_insert_id($this->dbLink);
      $this->affected_rows=mysql_affected_rows($this->dbLink);
      $this->free_result($query_id);
        }

  function update($sql,$dbbase="office"){  //  更新命令
      $query_id=$this->query($sql,$dbbase);
      $this->affected_rows=mysql_affected_rows($this->dbLink);
      $this->free_result($query_id);
      }

  function count_records($table,$index="id",$where="",$dbbase="office"){ // 记录总共表的数目
                                                   // where为条件
                                                   // dbbase为数据库
                                                   // index为所选key,默认为id
        if($dbbase!="") $this->change_db($dbbase);
        $result=@mysql_query("select count(".$index.") as 'num' from $table ".$where,$this->dbLink);
        if(!$result) $this->halt("错误的SQL语句: ".$sql);
        @$num = mysql_result($result,0,"num");
        return $num;
      }

  function query($sql,$dbbase="office"){   // 执行queyr指令
      if($dbbase!="") $this->change_db($dbbase);
    $this->query_id=@mysql_query($sql,$this->dbLink);
    if(!$this->query_id) $this->halt("错误的SQL语句: ".$sql);
    return $this->query_id;
      }

  function halt($errmsg)  // 数据库出错,无法连接成功
        {
            $msg="<h3><b>数据库出错!</b></h3><br>";
            $msg.=$errmsg;
            echo $msg;
            die();
      }

  function free_result($query_id)  // 释放query选择
        {
        @mysql_free_result($query_id);
        }

  function close()        //关闭数据库连接
        {
      mysql_close($this->dbLink);
        }
}

$DB=new DB_MYSQL;
$DB->dbServer="localhost";
$DB->dbUser="root";
$DB->dbPwd="********";
$DB->dbDatabase="office";
$dbbase="office";
?>

--------------------
There are Pretenders among us.Geniuses with the ability to become anyone they want to be. [ 2005-05-20 08:17:50 suchasplus 修改 ]
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
7C#
发布于:2005-05-20 08:16
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
为什么NORTH每次都用繁体? -------------------- There are Pretenders among us.Geniuses with the ability to become anyone they want to be.
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
0000
作家
作家
  • 铜币143枚
  • 威望34点
  • 贡献值1点
8C#
发布于:2005-05-20 13:56
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
正體比簡化體好看.中文嘛. --------------------            [a=http://northlight.digital-pulse.net/]寻找失落的路灯 @ North.Light[/a]
   有沒有事比死更容易? 有沒有事比活更難?
               ~     幸福是一雙溫暖的紅唇    ~
.--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
chocolate5215
著名写手
著名写手
  • 铜币9枚
  • 威望0点
  • 贡献值0点
9C#
发布于:2005-05-25 22:10
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
 。。。

我用 IIS + SQL Server 2000 --------------------
[img]http://www.memail.net/images3/682771441632957957_71198.jpg[/img]
0000
作家
作家
  • 铜币143枚
  • 威望34点
  • 贡献值1点
10C#
发布于:2005-05-26 08:41
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
IIS+PHP+SQLSERVER也沒問題嘛。。
把 mysql_xxxx 都換成 mssql_xxx 就行了。。。
查找 替換?。。。。 --------------------            [a=http://northlight.digital-pulse.net/]寻找失落的路灯 @ North.Light[/a]
   有沒有事比死更容易? 有沒有事比活更難?
               ~     幸福是一雙溫暖的紅唇    ~
.--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
11C#
发布于:2005-05-27 17:36
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
CHOK你不是ASP么~

NORTH的图片呢? -------------------- There are Pretenders among us.Geniuses with the ability to become anyone they want to be.
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
0000
作家
作家
  • 铜币143枚
  • 威望34点
  • 贡献值1点
12C#
发布于:2005-05-28 09:41
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
圖片?。。。什麽圖。。。俺的簽名很久沒有圖了。 --------------------            [a=http://northlight.digital-pulse.net/]寻找失落的路灯 @ North.Light[/a]
   有沒有事比死更容易? 有沒有事比活更難?
               ~     幸福是一雙溫暖的紅唇    ~
.--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
0000
作家
作家
  • 铜币143枚
  • 威望34点
  • 贡献值1点
13C#
发布于:2005-05-28 09:43
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
PS:   不要叫我such
至少suchas~  thks
否则我叫你chok~~  呵呵


BTW: please call me 0000. thks. [em078] --------------------            [a=http://northlight.digital-pulse.net/]寻找失落的路灯 @ North.Light[/a]
   有沒有事比死更容易? 有沒有事比活更難?
               ~     幸福是一雙溫暖的紅唇    ~
.--. |o_o | |:_/ | // \ \ (| | ) /'\_ _/`\ \___)=(___/
suchasplus
作家
作家
  • 铜币16枚
  • 威望11点
  • 贡献值1点
14C#
发布于:2005-05-29 23:41
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
0000是我们班魔兽天师的ID  
呵呵
NORTH你好像是机电的? -------------------- There are Pretenders among us.Geniuses with the ability to become anyone they want to be.
The history of these days will be written in blood... By crushing the armies of our enemy, by seizing the weapons they thought to turn against us, we were fighting for our very existence!
chocolate5215
著名写手
著名写手
  • 铜币9枚
  • 威望0点
  • 贡献值0点
15C#
发布于:2005-06-10 22:33
Re:[紧急求助] Dreamweaver 中关于查询数据库的问题
... --------------------
[img]http://www.memail.net/images3/682771441632957957_71198.jpg[/img]
游客

返回顶部