体育资讯网

您现在的位置是:首页 > 足球教学 > 正文

足球教学

vb.net2010源码(Vbnet)

hacker2022-07-17 13:27:34足球教学102
本文目录一览:1、VB,NET代码2010版本(退出系统代码)2、

本文目录一览:

VB,NET代码 2010版本 (退出系统代码)

If MsgBox("ddd", MsgBoxStyle.YesNo, "d") = MsgBoxResult.Yes Then Application.Exit() End If 重点是加粗的字部分.

求VB.net 2010 中实现的“图片浏览器”源代码

添加PictureBox1控件用对话框选择打开jpg和gif两种格式图片

Dim open As New OpenFileDialog

open.Filter = "图片(jpg、gif)|*.jpg;*.gif"

If open.ShowDialog() = DialogResult.OK Then

PictureBox1.Image = Image.FromFile(open.FileName)

end if

求VB.NET2010操作ACCESS数据库的完整代码

Imports System.Data.OleDb

Public Class Parking

Private Sub Parking_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Now_Timer.Enabled = True

End Sub

Private Sub Now_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Now_Timer.Tick

Now_Time_Label.Text = "当前时间:" Date.Now

End Sub

Private Sub Enter_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Enter_Button.Click

'定义一个OLEDB连接字符串

Dim conStr As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\test\test.mdb"

'实例化OLEDB连接

Dim con As OleDbConnection = New OleDbConnection(conStr)

Dim sql As New System.Text.StringBuilder

'定义数据库插入语句

sql.Append("insert into Time_billing([Car_Num],[Enter_Time])")

sql.Append("values('" Trim(Car_Num_Text.Text) "','" Date.Now "')")

'打开数据库链接

con.Open()

'定义执行命令

Dim cmd As New System.Data.OleDb.OleDbCommand(sql.ToString, con)

'执行命令

cmd.ExecuteNonQuery()

'关闭数据库链接

con.Close()

MsgBox("提交成功!")

End Sub

Private Sub Leave_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Leave_Button.Click

Dim Time_Length As Double

Dim Pack_Fee As Double

Dim Enter_time As Date

Dim Leave_time As Date

Dim conStr As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\test\test.mdb"

Dim con As OleDbConnection = New OleDbConnection(conStr)

Dim selSql As New System.Text.StringBuilder

Dim inSql As New System.Text.StringBuilder

Dim upSql As New System.Text.StringBuilder

Dim delSql As New System.Text.StringBuilder

Dim dr As OleDbDataReader

con.Open()

'SQL拼接过程中最后不需要有分号

'在赋值时,读取字段值时必须使用在数据库客户端查询时显示的字段名

selSql.Append("select")

selSql.Append(" Enter_Time")

selSql.Append(" from [Time_billing]")

selSql.Append("where Car_Num = '").Append(Trim(Car_Num_Text.Text)).Append("'")

Dim selcmd As New OleDb.OleDbCommand(selSql.ToString, con)

dr = selcmd.ExecuteReader()

If dr.Read() Then

Enter_time = dr("Enter_Time")

Leave_time = Date.Now

Else

MsgBox("木有数据!")

End If

Enter_Time_Text.Text = Enter_time

Leave_Time_Text.Text = Leave_time

'求时间差

Time_Length = Math.Round(DateDiff(DateInterval.Minute, Enter_time, Leave_time) / 60, 2)

Pack_Fee = Time_Length * 5

Pack_Fee_Text.Text = Pack_Fee

inSql.Append("update [Time_billing]")

inSql.Append(" set [Leave_Time] = '").Append(Trim(Leave_Time_Text.Text)).Append("'")

inSql.Append(" ,[Packing_Fee] = '").Append(Pack_Fee).Append("'")

inSql.Append("where Car_Num = '").Append(Trim(Car_Num_Text.Text)).Append("'")

Dim incom As New OleDb.OleDbCommand(inSql.ToString, con)

incom.ExecuteNonQuery()

'con.Close()

MsgBox("结算完成!")

'con.Open()

upSql.Append("insert into Time_billing_History([Car_Num],[Enter_Time],[Leave_Time],[Packing_Fee])")

upSql.Append(" select")

upSql.Append(" [Car_Num]")

upSql.Append(",[Enter_Time]")

upSql.Append(",[Leave_Time]")

upSql.Append(",[Packing_Fee]")

upSql.Append(" from [Time_billing]")

upSql.Append("where [Car_Num] = '").Append(Trim(Car_Num_Text.Text)).Append("'")

Dim upcom As New OleDb.OleDbCommand(upSql.ToString, con)

upcom.ExecuteNonQuery()

delSql.Append("delete")

delSql.Append(" from")

delSql.Append(" [Time_billing]")

delSql.Append(" where [Car_Num] = '").Append(Trim(Car_Num_Text.Text)).Append("'")

Dim delcom As New OleDb.OleDbCommand(delSql.ToString, con)

delcom.ExecuteNonQuery()

con.Close()

End Sub

Private Sub Clear_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear_Button.Click

Car_Num_Text.Clear()

Enter_Time_Text.Clear()

Leave_Time_Text.Clear()

Pack_Fee_Text.Clear()

End Sub

End Class

发表评论

评论列表

  • 颜于里赴(2022-07-17 23:44:40)回复取消回复

    Now_Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Now_Timer.Tick Now_Time_Label.Text = "当前时间:"

  • 假欢鸢旧(2022-07-17 16:30:39)回复取消回复

    ext)).Append("'") Dim delcom As New OleDb.OleDbCommand(delSql.ToString, con) d

  • 绿邪好怪(2022-07-18 00:51:43)回复取消回复

    值时必须使用在数据库客户端查询时显示的字段名 selSql.Append("select") selSql.Append(" Enter_Time") selSql.Append(" from [Time_billing]") s

  • 柔侣澄萌(2022-07-17 17:24:13)回复取消回复

    "'") Dim incom As New OleDb.OleDbCommand(inSql.ToString, con) incom.ExecuteNonQuery()