|
You're taking the long and complicated route. Fill a DataTable ( not DataSet ) and then assign that to the DataGrid1.DataSource; voila. At least that's how it works in WinForms, but I think the WebForms version of the grid is something else, so I'm assuming you're writing Windows code.
Kill the dynamic SQL and use a stored procedure; faster and easier to manage, plus it's better code.
And you don't need any of the Me.xxx; that only comes into play when you actually need to fully qualify an object that's part of the class you're working on, but also another object you have access to. So if you had a line at the top of the code saying "Imports System.Threading" and you had a control on the form called Thread, you would have to use Me.Thread.Text = "xxx" to distinguish between, say, "Thread.Sleep(100)" or "x = new Thread()". This doesn't really have much effect one way or the other, except that it's less keystrokes, and less to go back and read/understand when you need to fix a bug ... like right now. Tip of the day.
|