Click here to Skip to main content
15,907,326 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
VB
Try
            Dim sql As String = "SELECT MAX(ppo_no) FROM Pension_Master where state_code= '" & TextBox9.Text & "' "
            Dim comm As SqlCommand = New SqlCommand(sql, myconn)
            myReader = comm.ExecuteReader
            If myReader.HasRows Then
                While myReader.Read()
                    temp = myReader.Item("TextBox5.Text") + ("TextBox9.Text")
                End While
            End If

        Catch ex As Exception

        End Try

        TextBox8.Text = String.Concat(temp)
        'TextBox8.Text = TextBox5.Text & TextBox9.Text
        myReader.Close()

        cmd.ExecuteNonQuery()
Posted
Comments
BK 4 code 6-Jan-14 3:44am    
Not clear question , pelase give us more detail

Looking at your code, I would say No it's not correct.
What are you actually trying to do because I do not believe that the code in the while loop will work, and cmd.ExecuteNonQuery() seems unnecessary at the end of the method.

The code is also open to SQL Injection attacks.
 
Share this answer
 
No and on so many levels I don't have sufficient space in a forum post, or time to type them all up, to list them all.

You also don't specify to what "fitness" you expect for an answer. Does the code work for whatever it is you're trying to make it do? Probably not. We can't answer this as you haven't said anything about what this code is supposed to do.

Is it secure? Not in the least.

Is it production quality? Nowhere near it.


Pickup a beginners book on VB.NET and work through it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900