vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, Could some kind soul help me fix my code? I want to call stored procedures to out put to a datagrid with five columns (string, datetime, string, string, string) that are sortable and pageable. I can't get my code to produce client results. I want to use stored procedures but, for this example, I am testing with just a select statement: Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) ' Call our stored procedure "GetRecordById" passing it ' the value of 1 for the id of a record to return. Dim myConnection As MySqlConnection Dim myCommand As MySqlCommand Dim myParameter As MySqlParameter Dim myDataReader As MySqlDataReader ' Create a connection to our MySQL database myConnection = New MySqlConnection("myConnectionString) ' Create a command, set it as a stored proc, and give it the proc name myCommand = myConnection.CreateCommand() myCommand.CommandType = CommandType.Text myCommand.CommandText = "select * from users" ' Create a new parameter and set its name and value 'myCommand.Parameters.Add(New MySqlParameter("parId", 1)) ' Open the connection and use a DataReader to get our data myConnection.Open() myDataReader = myCommand.ExecuteReader() ' Bind the reader to our datagrid Me.MyDataGrid.DataSource = myDataReader Me.MyDataGrid.DataBind() ' Close our DataReader and Connection myDataReader.Close() myConnection.Close() End Sub <form id="Form1" runat="server"> <ASP id="MyDataGrid" runat="server" AllowSorting="true" OnSortCommand="MyDataGrid_Sort" BorderColor="#eaeaea" BorderWidth="1" CellPadding="10" Font- Name="Verdana" Font-Size="12pt" Width="100%" BackColor="#ccccff" ShowFooter="false" HeaderStyle- BackColor="#6699cc" HeaderStyle- ForeColor="#fff" HeaderStyle-Font- Underline="true" EnableViewState="false" Height="100%" GridLines="both" /> </form> |
| |||
| OK, I have figured out how this works, thanks. Maybe somebody could show me how to format my output? For example, I want all my date info (star, stop, times) in one column. And, titile and description in another. Thanks again! |
| ||||
| On Mar 9, 6:45 am, pbd22 <dush...@gmail.com> wrote: > OK, I have figured out how this works, thanks. > Maybe somebody could show me how to format my output? > For example, I want all my date info (star, stop, times) in one > column. And, titile and description in another. > > Thanks again! If you solved it, you should post your solution, in case someone else has a similar problem. If you have a new problem, you should make a new post with a new subject. Again, in case someone else has a similar problem. ;-) |