I recently wrote an asp.net forum, and the vb.net forum is basically finished ..
I will share with you a method I used when writing code... although it is simple, it still has some reference value for beginners...
As you know, to write a dynamic web page, you must operate on the database and use the SQL language. Sometimes, if the SQL language is incorrectly written, the web page cannot run .. how can I check whether the SQL language is correctly written? In sqlserver, it is easy to use the query analyzer to try it, but it is not useful for access databases (considering the convenience of migration, I use access as a database). How can I check whether access is correct for an SQL language?
For example, I write this statement.
Select count (*) from articles where boardid = 1 or reply in (select id from articles where boardid = 1)
After writing it out, you cannot immediately determine whether it is correct. I use this method to handle it:
1. Write a simple page with three controls. You can see the figure.
The program of the onclick event triggered by button1 is as follows:
Private Sub button#click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles Button1.Click
Dim str As String = Trim (TextBox1.Text)
Dim mycommand = New OleDbCommand (str, conn)
Conn. Open ()
Label1.Text = mycommand.exe cutescalar ()
End Sub
The specific implementation method is as follows:
[Color = # FF0000] obtain the SQL string from textbox1 and execute the SQL statement using button1. The execution result is displayed on label1. [/color]