Connect DB Ms Sql Server 7.0

   
 


 

 

Home

Board-Forum-Diary

Administrator

ASP

=> ASP?

=> ASP : Connection Object

=> Connect DB access

=> Connect DB Ms Sql Server 7.0

=> ASP and SQL

=> ASP Mysql (ODBC)

=> ASP export Excel

=> ASP export Graph

=> ASP MS-word

=> ASP read data EXCEL

=> ASP read data EXCEL2

Business Manage

Computer Basic

Computer Hardware

Computer Software

Computer Tip

Computer Virus

Contact

Database

Firefox

Gallery

Game

HI5 ME!

Link

Project Demo

System Analysis

Website

Food & Drink

SkyDrive

MS-word

MS-excel

Mobile

Drug

Clock

Car & Motorcycle

Download

 


     
 

หัวข้อนี้จะได้เรียนรู้วิธีการติดต่อกับฐานข้อมูล Ms Sql Server 7.0

ให้สร้างฐานข้อมูลดังต่อไปนี้

ชื่อฐานข้อมูล product

ชื่อตาราง product
ชื่อ Field
- id
- barcode
- description
- price
- page
- writer




การติดต่อกับ Ms Sql Server 7.0 ต้องทำการติดต่อผ่าน ODBC ซึ่งเราจะต้องทำการสร้าง DSN เพื่อใช้อ้างอิงสำหรับการติดต่อ
ให้สร้าง DSN ตามตัวอย่างต่อไปนี้


ให้ไปที่
Win95,Win98,Me -> Start - Control Panel
WinNT,2000,XP -> Start - Control Panel - Administrative Tools

ให้ดับเบิ้ลคลิก



ซึ่ง windows 2 ประเภทจะไม่เหมือนกัน แต่จะคล้าย ๆ นี้ครับ





รูปแบบในส่วนนี้ถ้า Win95,Win98,Me ให้เลือกแท็บของ User DSN

WinNT,2000,XP ให้เลือกแท็บของ System DSN

และเลือก Add จากนั้นเลือก Driver ของ SQL Server และ Finish ตามลำดับ




กำหนดชื่อ DSN ในที่นี้ผมกำหนดเป็น Msproduct





กำหนด user และ password





เลือกชื่อฐานข้อมูลในที่นี้ผมเลือก product



เลือก Next



ถ้าปรากฏรูปแบบนี้แสดงว่าการติดต่อกับฐานข้อมูลสำเร็จ ให้เลือก OK




เป็นอันเสร็จกับการสร้าง DSN เพื่อใช้ในการติดต่อแบบ ODBC ต่อไปก็คือการเขียน code เพื่อติดต่อกับ DSN


Set Conn=Server.Createobject("ADODB.Connection")
Conn.Open "Msproduct","sa",""

 
 

Total, there have been 250693 visitors (515168 hits) on this page!

 

 
This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free