十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
Dim myconn As New OleDb.OleDbConnection
创新互联长期为上1000+客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为临夏企业提供专业的网站建设、成都网站制作,临夏网站改版等技术服务。拥有十余年丰富建站经验和众多成功案例,为您定制开发。
Dim mycommand As New OleDb.OleDbCommand
myconn.ConnectionString = "Provider=Microsoft.ace.OLEDB.12.0;Data Source=C:\Users\Administrator\Documents\账号密码.accdb "
myconn.Open()
mycommand.Connection = myconn
Dim sql5 As String = "delete from 表3 where userid='" (TextBox1.Text) "'"
mycommand.CommandText = sql5
mycommand.CommandType = CommandType.Text
mycommand.ExecuteNonQuery()
Dim sql3 As String = "update 表2 set Balance=Balance-2 where UserID='" (TextBox1.Text) "'"
mycommand.CommandText = sql3
mycommand.CommandType = CommandType.Text
mycommand.ExecuteNonQuery()
myconn.Close()
来给你写了个函数,拿去用,不谢
Function RemoveAt(Of T)(ByVal arr As T(), ByVal index As Integer) As T()
Dim uBound = arr.GetUpperBound(0)
Dim lBound = arr.GetLowerBound(0)
Dim arrLen = uBound - lBound
If index lBound OrElse index uBound Then
Throw New ArgumentOutOfRangeException( _
String.Format("Index must be from {0} to {1}.", lBound, uBound))
Else
Dim outArr(arrLen - 1) As T
Array.Copy(arr, 0, outArr, 0, index)
Array.Copy(arr, index + 1, outArr, index, uBound - index)
Return outArr
End If
End Function
vb.net已经去掉了控件数组这个类,不过有个代替该方式的一个属性:Tag,你可以把这些关联的Tag属性设置为同一标记,如:a。然后遍历所有的checkbox并且tag为a的则选定:Protected Sub chkAll_Click() For Each ctl As Control In Me.Controls ''如果checkbox在一个容器里,比如groupbox,那可以用groupbox.controls
If ctl.GetType().Name.ToLower() = "checkbox" Then
CType(ctl, CheckBox).Checked = CheckBox3.Checked
End If
NextEnd Sub
For i = 0 To 10 '假设数组长度为10
If a(i) = 3 Then
For j = i To 10 - 1
a(j) = a(j + 1)
Next j
ReDim Preserve a(10 - 1)
Exit For
End If
Next i
If i 10 Then
For k = 0 To 10 - 1
Print a(k)
Next
Else
For k = 0 To 10
Print a(k)
Next
End If
Dim array1() As String
Dim array2() As Boolean
Dim i As Integer
Dim j As Integer
Dim str1 As String = "a,c,c,c,a,b,c,d,f,eee,eee"
array1 = Split(str1, ",")
str1 = ""
ReDim array2(UBound(array1))
For i = 0 To UBound(array1)
array2(i) = False
Next
For i = 0 To UBound(array1) - 1
If array2(i) = False Then
For j = i + 1 To UBound(array1)
If array1(i) = array1(j) And array2(j) = False Then
array2(j) = True
End If
Next j
End If
Next i
For i = 0 To UBound(array1)
If array2(i) = False Then
str1 = str1 array1(i) ","
End If
Next i
If str1 "" Then
str1 = Strings.Left(str1, Len(str1) - 1)
End If