Dim da As String = "SELECT Count(檢測(cè)項(xiàng)目) FROM b where 檢測(cè)項(xiàng)目='cc'"
成都創(chuàng)新互聯(lián)公司專注于左權(quán)網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供左權(quán)營(yíng)銷型網(wǎng)站建設(shè),左權(quán)網(wǎng)站制作、左權(quán)網(wǎng)頁設(shè)計(jì)、左權(quán)網(wǎng)站官網(wǎng)定制、小程序開發(fā)服務(wù),打造左權(quán)網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供左權(quán)網(wǎng)站排名全網(wǎng)營(yíng)銷落地服務(wù)。
這句寫錯(cuò)啦,你直接傳送的是檢測(cè)項(xiàng)目為字符串"cc"的參數(shù),并不是你程序?qū)懙腃C參數(shù)
改為:
Dim da As String = "SELECT Count(檢測(cè)項(xiàng)目) FROM b where 檢測(cè)項(xiàng)目='" cc "'"
建議通過程序組織的sql語句可以通過msgbox da 彈出來看看,這樣你較容易查出是什么錯(cuò)誤,較長(zhǎng)的就用textbox1.text=da來看了,不過記得設(shè)置斷點(diǎn)"exit sub"
使用ACCESS數(shù)據(jù)庫的日期列比較,應(yīng)為:
"select * from 表 where 日期列=" "#" cdate(textbox1.text) "#"
注意前后兩個(gè)“#”號(hào)
使用sqlserver
"select * from 表 where 日期列=" "'" cdate(textbox1.text) "'"
當(dāng)然日期格式要注意,如長(zhǎng)短日期等。
日期期間:between 小日期 and 大日期(記得加#號(hào))
字符串的操作應(yīng)用
[vb]
Module Module
Sub Main()
定義 個(gè)字符串變量
Dim str str str As String
給str str 付初值
str = Hello : str = World
Console WriteLine( 方法Concat )
連接一個(gè)或多個(gè)字符串
Console WriteLine( str ={ } str ={ } String Concat(str str )={ } str str String Concat(str str ))
判斷字符串中是否具有相同的值返回類型為布爾型
Console WriteLine( 方法Equals )
Console WriteLine( str ={ } str ={ } String Equals(str )={ } str str str Equals(str ))
在字符串中指定索引位置插入指定的字符串
Console WriteLine( 方法Insert )
str = : str = aaa
Console WriteLine( str ={ } str ={ } str Insert( str )={ } str str str Insert( str ))
左右對(duì)齊字符串中的字符
Console WriteLine( 方法PadLeft/PadRight )
str = World : str = 世界
Console WriteLine( str ={ } str )
Console WriteLine( str PadLeft( * )={ } str PadRight( * )={ } str PadLeft( * ) str PadRight( * ))
Console WriteLine( str ={ } str )
Console WriteLine( str PadLeft( * )={ } str PadRight( * )={ } str PadLeft( * ) str PadRight( * ))
找出指定字符串或字符轉(zhuǎn)在此字符串中的第一個(gè) 最后一個(gè)匹配項(xiàng)的索引位置
Console WriteLine( 方法IndexOf/LastIndexOf )
str = Visual Basic NET ASP NET C# NET
Console WriteLine( str ={ } str )
Console WriteLine( str IndexOf( NET )={ } str LastIndexOf( NET )={ } str IndexOf( NET ) str LastIndexOf( NET ))
將字符串中的字符復(fù)制到字符串?dāng)?shù)組
Console WriteLine( 方法ToCharArray )
str = str ToCharArray(str IndexOf( NET ) )
Console WriteLine( str ={ } str )
Console WriteLine( str ToCharArray(str IndexOf( NET ) )={ } str )
在指定字符串?dāng)?shù)組的每個(gè)元素之間串聯(lián)指定的分隔符 產(chǎn)生單個(gè)串聯(lián)的字符串
Console WriteLine( 方法Join )
Dim myArray( ) As String
myArray( ) = I : myArray( ) = am : myArray( ) = a : myArray( ) = student
For i As Integer = To
Console Write( myArrat({ })={ } i myArray(i))
Next
Console WriteLine()
Console WriteLine( String Join( * myArray)={ } String Join( * myArray))
此字符串中刪除指定個(gè)數(shù)字符
Console WriteLine( 方法Remove )
str =
Console WriteLine( str ={ } str Remove( )={ } str str Remove( ))
將此字符串指定字符串字符的所有匹配項(xiàng)代替為其他指定字符串
Console WriteLine( 方法Replace )
str =
str = abc
Console WriteLine( str ={ } str ={ } str ={ } str Replace(str str )={ } str str str str Replace(str str ))
從此字符串檢索字符串
Console WriteLine( 方法SubString )
Console WriteLine( str ={ } str Substring( )={ } str str Substring( ))
Console ReadLine()
End Sub
lishixinzhi/Article/program/net/201311/13956
在VB6以及VB.Net可以用? ""? 輸入空字符串。例如
Dim?s?As?String
s?=?""
在VB.Net中還可以用String.Empty輸入空字符串。例如
Dim?s?As?String
s?=?String.Empty
用字符串保存兩個(gè)數(shù)據(jù),當(dāng)然只有你這種辦法,另外提供你其它思路:
1. flexcell增加兩列,這兩列隱藏不顯示,額外數(shù)據(jù)可以從這兩列讀取
2. 用自定義類型數(shù)組,保存這兩列數(shù)據(jù),數(shù)組順序和表格一樣,或者數(shù)組中增加一個(gè)ID元素,與表格對(duì)應(yīng)
假如Form1有個(gè)TextBox1,雙擊TextBox1填入123
Public Class Form1
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
System.Windows.Forms.SendKeys.Send("123")
End Sub
End Class
看你的VB.NET 版本了
用 My.Computer.Keyboard.SendKeys("123", True) 代替 System.Windows.Forms.SendKeys.Send("123") 也可以
原碼:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
My.Computer.Keyboard.SendKeys("123", True)
End Sub
End Class