⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transactions.vb

📁 聊天 聊天 聊天 聊天 聊天 聊天
💻 VB
字号:
Option Strict Off
Imports System
Imports System.Collections
Imports System.Text
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.UI
Imports System.Web.UI.WebControls

Public Class BaseClass

Inherits System.Web.UI.Page
protected Grid1 as DataGrid
Protected Message as label, title as label
Protected aposted_display as dropdownlist, selection as dropdownlist
Protected AddPanel as Panel
Protected adate as TextBox, aref as TextBox, adr_amount as TextBox
Protected  acr_amount as TextBox , anarr as TextBox 
Protected addshow as button
Dim ds           As New DataSet
Dim ConnStr      As String
Dim SQL          As String
Sub Page_Load(Source As Object, E As EventArgs) 
	ConnStr = "Provider=SQLOLEDB; Data Source=(local); Initial Catalog=ASPNET;User ID=sa;"
	if NOT (isPostBack)
	dim code as string, display as string
	'code = Request.Form("Selection")
	'title.text = code
	code = Session("TheSelectionValue")
	title.text = Session("TheSelectionText")
	if code = "" then
	response.redirect("selection.aspx")
	end if
	UpdateSelection(code)	
	rebind
	end if
End Sub
Sub ReBind()
	Dim t As New NameSpaceHersh.SQLService
	Dim ds as DataSet
	SQL = " select m.code_value,m.code_display,t.*, h.* ,"
	sql = sql + "(select code_display from masters where code_value = t.posted_to) as posted_display"
	sql = sql + " from tr_header h,transactions t, masters m "
	sql = sql + " where t.doc_no = h.doc_no "
	sql = sql + " and  m.code_value = t.code_value"
	sql = sql + " and m.code_value = (select selection from tblSelection)"
	ds = t.Populate(ConnStr, SQL)
	Grid1.DataSource=ds.Tables("vTable").DefaultView
	Grid1.DataBind()
	'populate account(add mode) selection drop down list
	'SQL = "Select * from masters"
	SQL = "Select * from masters where code_value <> "
	SQL = SQL + " (select selection from tblSelection)" 
	ds = t.Populate(ConnStr, SQL)
	aposted_display.DataSource=ds.Tables("vTable").DefaultView
	aposted_display.DataBind()
	addshow.visible = true
End Sub
Sub Grid1_Edit(Sender As Object, E As DataGridCommandEventArgs)
	Grid1.EditItemIndex = E.Item.ItemIndex
	ReBind()
End Sub
Sub Grid1_Cancel(Sender As Object, E As DataGridCommandEventArgs)
	Grid1.EditItemIndex = -1
	ReBind()
End Sub
Sub RunSql(vsql as string)
	
	Dim t As New NameSpaceHersh.SQLService
	Dim s as string
	s = t.RunSQL(ConnStr,vSQL)
	Grid1.EditItemIndex = -1
	Rebind
	if s <> "Success" then
	   Message.Text = s
	   Message.Style("color") = "red"
	End if
End sub
sub hidePanel()
	if AddPanel.visible = true then
	   AddPanel.visible = false
	   'reset values
	   adate.text = ""
	   aref.text = ""
	   adr_amount.text = ""
	   acr_amount.text = ""
	   anarr.text = ""
	end if
end sub
Sub UpdateSelection(vselection)
	sql = "delete from tblSelection "
	sql = sql + " insert into tblSelection(selection)"
	sql = sql + " values('" + vselection + "')"
	runSql(sql)
End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -