记录生活

C++&OTL调用SQLServer成功

<Category: C++> 查看评论
#include 
using namespace std;
#include 

#define _ODBC_MSSQL_2005 // Compile  3.1/OCI7
#include "otlv4.h" // include the  4 header file

//Table--Create--Script-----begin---------------------------------------------------
//USE [Matrix]
//GO
///****** Object:  Table [dbo].[tb1]    Script Date: 10/10/2009 16:40:55 ******/
//SET ANSI_NULLS ON
//GO
//SET QUOTED_IDENTIFIER ON
//GO
//SET ANSI_PADDING ON
//GO
//CREATE TABLE [dbo].[tb1](
//	[cl1] [varchar](50) COLLATE SQL_Latin1_General_CP1_CS_AS NULL,
//	[cl2] [varchar](50) COLLATE SQL_Latin1_General_CP1_CS_AS NULL
//) ON [PRIMARY]
//
//GO
//SET ANSI_PADDING ON
//Table--Create--Script-----end-----------------------------------------------------

_connect db; // connect object

void insert()
// insert rows into table
{
    //删除测试数据
   _stream d;
    d.open(50, // buffer size
   "truncate  Table tb1; ",db);

 _stream o(50, // buffer size
              "insert into tb1 values(:cl1,:cl2)",
                 // SQL statement
              db // connect object
             );
 char tmp[32];

 for(int i=1;i<=100;++i){
  sprintf(tmp,"Name%d",i);
  o<<(float)i<) ",
   db);

    //输入显示大于数字的记录数
    int var1;
    cin>>var1;
    i<>f1>>f2;
  cout<<"f1="<

本文来自: C++&OTL调用SQLServer成功



只有 1 条评论 订阅该文评论 RSS

Demarcus Tarufelli

strong weblog you take

发表评论

您必须登录后才能发表评论。