0
私はラジオボタン名を選択するとSQLサーバースクリプトにわずかな問題がありますが、このスクリプトは名前を検索するが、会社名に基づいて検索ボタン上のホテル 次のコードVB.NETでSQL言語を使用したレコード検索スクリプト
enter code here
#Region "GuestList"
Sub SearchRecord()
If TextBox1.Text = "" Then
MsgBox("Please Insert The Key", MsgBoxStyle.Information, "Searching Record")
TextBox1.Focus()
Exit Sub
End If
Try
If rdoname.Checked = True Then
dtadapter = New SqlDataAdapter("select firstname as [First Name],lastname as [Last Name], address as [Address], country as [Country], company as [Company], datein as [Date In], dateout as [Date Out], note as [Note] from tcekin Where fistname = '" & TextBox1.Text & "'", connection)
Else
dtadapter = New SqlDataAdapter("select firstname as [First Name],lastname as [Last Name], address as [Address], country as [Country], company as [Company], datein as [Date In], dateout as [Date Out], note as [Note] from tcekin Where company = '" & TextBox1.Text & "%'", connection)
End If
Dim tcekin As New DataTable
tcekin.Clear()
dtadapter.Fill(tcekin)
If tcekin.Rows.Count = Nothing Then
MsgBox("Data Not Found", MsgBoxStyle.Information, "Attention")
TextBox1.Clear()
TextBox1.Focus()
Exit Sub
End If
Catch ex As SqlException
MsgBox(ex.Message, MsgBoxStyle.Information, "Attention")
End Try
End Sub
#end region
ため、このプログラムは、私がSearchRecord呼ばれてきましたが、それは動作しません。
これについては、あなたは馬鹿になるでしょう。ニースSQLインジェクション... http://en.wikipedia.org/wiki/SQL_injection –
コメントを+1してください。また、 "それは動作しません"ほとんど説明されていません。あなたはデバッグを試みましたか?このSearchRecordメソッド内でブレークポイントに達しましたか?どのようなエラーが出ますか? – InSane
何を手に入れますか?エラーが発生したか、結果が表示されません – Wade73