如何用C#取Notes数据库中的数值
小弟在项目开发中遇到一个问题。要读取Notes中的数据到SQLserver数据库,
我想通过ODBC连接Notes,下了个NoteSQL,添加完DNS,不知道怎么连接,
网上搜了几天好像没有什么资料啊,有哪位大哥做过类似的程序没,帮帮忙啊!
有相关代码的,给满分,通过散分!!!!!
--------------------编程问答-------------------- 不懂啊
帮顶 --------------------编程问答-------------------- 我记得好象IBM的网站有讲到这个的,LZ去看看IBM的官方网站.或者逛逛notes开发的论坛的吧 --------------------编程问答-------------------- 去看过,都是在Notes中用ODBC连接SQLServer,通过LotesScripts导入数据库
不符合要求阿 --------------------编程问答-------------------- 没用过,不过建议看看notes的帮助文档 --------------------编程问答-------------------- 不会...帮顶 --------------------编程问答-------------------- 最近刚好在做。。下面是odbc的连接字符串
DRIVER={Lotus NotesSQL Driver (*.nsf)};Database=AgentRunner.nsf;Server=local;UserName=Notes_Han/notes;MaxSubquery=20;MaxStmtLen=4096;MaxRels=20;MaxVarcharLen=254;KeepTempIdx=1;MaxLongVarcharLen=512;ShowImplicitFlds=0;MapSpecialChars=1;ThreadTimeout=60; --------------------编程问答-------------------- using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Odbc;
using System.Data;
using System.Collections;
namespace Han_DBase
{
public class Han_DBOdbc
{
private OdbcConnection conn;
private OdbcTransaction trans;
private bool inTransaction = false;
private OdbcCommand m_DbCommand = null;
private OdbcDataAdapter m_DbDataAdapter = null;
public Han_DBOdbc(string strConnection)
{
this.conn = new OdbcConnection(strConnection);
if (m_DbCommand == null)
{
m_DbCommand = new OdbcCommand();
m_DbCommand.Connection = this.conn;
m_DbDataAdapter = new OdbcDataAdapter();
m_DbDataAdapter.SelectCommand = m_DbCommand;
}
}
/// <summary>
/// 获得当前正在使用的连接的引用(屬性)^_^
/// </summary>
public IDbConnection Connection
{
get { return this.conn; }
}
/// <summary>
/// 打开数据库连接,一般情況下沒必要使用^_^
/// </summary>
public void Open()
{
if (conn.State.ToString().ToUpper() != "OPEN")
{
this.conn.Open();
}
}
/// <summary>
/// 关闭数据库连接^_^
/// </summary>
public void Close()
{
if (conn.State.ToString().ToUpper() == "OPEN")
{
this.conn.Close();
}
}
/// <summary>
/// 执行一条返回bool的SQL语句(insert,update,delete......)^_^
/// </summary>
/// <param name="strSql">SQL语句</param>
/// <returns>true or false</returns>
public bool exeSql(string strSql)
{
lock (m_DbCommand)
{
if (inTransaction)
{
m_DbCommand.Transaction = trans;
}
m_DbCommand.CommandText = this.ChangeQueryString(strSql);
if (this.conn.State == ConnectionState.Closed)
{
this.conn.Open();
}
lock (this.conn)
{
try
{
m_DbCommand.ExecuteNonQuery();
return true;
}
catch(Exception ex)
{
this.conn.Close();
return false;
}
finally
{
if (this.conn.State == ConnectionState.Open)
{
this.conn.Close();
}
}
}
}
}
需要什么方法自己加。。。
补充:.NET技术 , C#