SQL資料庫連線語句
阿新 • • 發佈:2019-02-04
http://zhengdl126.javaeye.com/blog/727782
一般的遠端訪問的寫成這樣:
Data Source=IP ;Initial Catalog=資料庫名 ;UserID= 使用者名稱 ;Password=密碼
本地訪問的寫成這樣:
Data Source=(local);Initial Catalog=資料庫名 ;UserID= 使用者名稱 ;Password=密碼
如果是本地的,通過windows元件驗證的(也就是沒有使用者名稱,密碼的)寫成這樣:
Data Source=(local);Initial Catalog=資料庫名 ;Integrated Security=True
如果不是預設的例項,假如例項名是SQLEXPRESS,寫成這樣:
Data Source=(local)/SQLEXPRESS ;Initial Catalog=資料庫名 ;Integrated Security=True
ExecuteReader 簡單高效的,單向前的資料查詢。返回一個SqlDataReader物件 通常用於讀取資料 ExecuteNonQuery 返回一個int型別的值,返回資料庫中所影響的行數。 用於對資料庫的各種操作 ExecuteScalar 返回讀出結果的第一行第一列 |
更新:2007 年 11 月
在工作流例項進入空閒狀態後發生
static
void
Main()
{
string
connectionString = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;"
;
using
(WorkflowRuntime workflowRuntime = new
WorkflowRuntime())
{
ExternalDataExchangeService dataService = new
workflowRuntime.AddService(dataService);
dataService.AddService(expenseService);
workflowRuntime.AddService(new SqlWorkflowPersistenceService(connectionString));
workflowRuntime.StartRuntime();
workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
workflowRuntime.WorkflowIdled += OnWorkflowIdled;
workflowRuntime.WorkflowAborted += OnWorkflowAborted;
Type type = typeof(SampleWorkflow1);
WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(type);
workflowInstance.Start();
waitHandle.WaitOne();
workflowRuntime.StopRuntime();
}
}