datawindow.net 在VS2008连接数据库的方式
1)
//连接数据库,并检索数据
dbConn =new SqlConnection("Server=(local); DataBase=NorthWind;uid=sa;pwd=sa");
dbConn.Open();
adoTrans = new AdoTransaction(dbConn);
adoTrans.BindConnection();
dataWindowControl1.Retrieve();
2)
Sybase.DataWindow.Transaction Trans = new Sybase.DataWindow.Transaction();
Trans.Dbms = Sybase.DataWindow.DbmsType.OleDb;//数据库连接方式
Trans.Password = "mis";
Trans.UserId = "mis";
Trans.AutoCommit = false;
Trans.Lock = "RC";
Trans.DbParameter = "PROVIDER='SQLOLEDB',DATASOURCE='IP.130', PROVIDERSTRING='database=cnemisd'";//数据库连接串
Trans.Connect();//连接数据库
WebDataWindowControl1.LibraryList = "demo.pbl";//发布后使用.pbd文件
WebDataWindowControl1.DataWindowObject = "dw_pu_pud_fwdz";//数据窗名称
WebDataWindowControl1.SetTransaction(Trans);
WebDataWindowControl1.Retrieve();//显示数据窗
Trans.Disconnect();
3、datawindow.net 在VS中按钮的操作
Dim ls_sqlca As Sybase.DataWindow.Transaction
Dim i As Integer, li_row As Integer
ds_1 = New Sybase.DataWindow.DataStore
ls_sqlca = Session("sqlca")
ds_1.LibraryList = Server.MapPath("") + "\salesdemo.pbl"
ds_1.DataWindowObject = "d_prod_list"
ds_1.SetTransaction(ls_sqlca)
For i = 1 To dw_1.RowCount
If CInt(dw_1.GetItemDouble(i, "p_select")) = 1 Then
li_row = ds_1.InsertRow(0)
ds_1.SetItemDouble(li_row, "id", dw_1.GetItemDouble(i, "id"))
ds_1.SetItemString(li_row, "name", dw_1.GetItemString(i, "name"))
ds_1.SetItemString(li_row, "description", dw_1.GetItemString(i, "description"))
ds_1.SetItemString(li_row, "prod_size", dw_1.GetItemString(i, "prod_size"))
ds_1.SetItemString(li_row, "picture_name", dw_1.GetItemString(i, "picture_name"))
ds_1.SetItemDouble(li_row, "unit_price", dw_1.GetItemDouble(i, "unit_price"))
End If
Next
Session("addlist") = True
Session("ds_state") = ds_1.GetFullState()
Response.Write("<script>window.close();</script>")