PDA

View Full Version : How Does ASP.NET Connect to My SQL



tomyknoker
03-02-2007, 02:41 AM
Hi,

I'm coming from PHP and am looking at a page but don't understand how the ASPX page connects to the database... Is it to with the MySql.Data.dll file? Also I have noticed that calls from that page to Columns in the MySQL database are written in lowercase... Is this to do with the MySQLDataGrid... Does ASP.NET talk to this first and is this where I need to specifiy what's in the DB?

codeexploiter
03-02-2007, 03:44 AM
Check this one (http://www.stardeveloper.com/articles/display.html?article=2003052201&page=9) and this one (http://www.15seconds.com/issue/050407.htm)

tomyknoker
03-02-2007, 04:20 AM
Check this one (http://www.stardeveloper.com/articles/display.html?article=2003052201&page=9) and this one (http://www.15seconds.com/issue/050407.htm)I still can't work out how the code on my ASP.NET page works... (they were great articles though)... Could I post it here are you much of a pro at ASP.NET?

codeexploiter
03-02-2007, 04:33 AM
hmmm i don't know much about ASP.NET I used to work in ASP earlier...But I would recommend posting code as it gives users a chance to see it and try to troubleshoot it for you :)

tomyknoker
03-02-2007, 04:51 AM
OK well here is the code, hopefully someone has some idea as I'm really stuck!
<asp:DataList ID="MySQLDataGrid"
runat="server"
OnEditCommand="Edit_Command"
OnUpdateCommand="Update_Command"
OnCancelCommand="Cancel_Command"
OnDeleteCommand="Delete_Command"
OnItemCreated="btnDelete_ItemCreated"
OnItemDataBound="ddl_ItemDataBound"
RepeatLayout="Table"
DataKeyField="ID"
autogeneratecolumns="False"
BorderStyle="None"
BorderWidth="0px"
CssClass="gdvw" Width="100&#37;">
<headertemplate>
<tr>
<td class="label" width="20%">&nbsp;&nbsp;&nbsp;<strong>Firstname</strong></td>
<td class="label" width="20%"><strong>Lastname</strong></td>
<td class="label" width="20%" align="center"><strong>State</strong></td>
<td class="label" width="20%" align="center">&nbsp;</td>
<td class="label" width="10%" align="center">&nbsp;</td>
<td class="label" width="20%" align="center">&nbsp;</td>
</tr>
</headertemplate>
<itemtemplate>
<tr>
<td class="label" width="20%">&nbsp;&nbsp;&nbsp;<a title="View Member's Profile" href="javascript:del=window.open('members_view.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID")%>','del','width=640,height=480,toolbar=no,menubar=no,status=no,titlebar=no,resizable=yes,scrollbars=yes');del.focus();" class="navlink"><%# DataBinder.Eval(Container.DataItem, "Firstname")%></a></td>
<td class="label" width="20%"><a title="View Member's Profile" href="javascript:del=window.open('members_view.aspx?id=<%# DataBinder.Eval(Container.DataItem, "ID")%>','del','width=640,height=480,toolbar=no,menubar=no,status=no,titlebar=no,resizable=yes,scrollbars=yes');del.focus();" class="navlink"><%# DataBinder.Eval(Container.DataItem, "lastname")%></a></td>
<td class="label" width="20%" align="center"><%# DataBinder.Eval(Container.DataItem, "state")%></td>
<td class="label" width="20%" align="center"></td>
<td class="label" width="10%" align="center"><asp:LinkButton ID="btnEdit" runat="server" CommandName="Edit" Text="Edit " CssClass="navlink" /></td>
<td class="label" width="10%" align="center"><asp:LinkButton ID="btnDelete" runat="server" CommandName="Delete" Text="Delete" CssClass="navlink" /></td>
</tr>
</itemtemplate>
<edititemtemplate>
<tr>
<td class="label2" width="20%">&nbsp;&nbsp;&nbsp;<%# DataBinder.Eval(Container.DataItem, "firstname")%></td>
<td class="label2" width="20%"><%# DataBinder.Eval(Container.DataItem, "lastname")%></td>
<td class="label2" width="20%" align="center"><%# DataBinder.Eval(Container.DataItem, "state")%></td>
<td class="label2" width="20%" align="center">
<asp:DropDownList ID="ddlstatus" runat="server" AutoPostBack="False" CssClass="ddl1">
<asp:ListItem Value="" Text="Please Select..."/>
<asp:ListItem Value="A" Text="Approved"/>
<asp:ListItem Value="D" Text="Deleted"/>
<asp:ListItem Value="H" Text="On Hold"/>
<asp:ListItem Value="P" Text="Pending"/>
<asp:ListItem Value="R" Text="Rejected"/>
</asp:DropDownList></td>
<td class="label2" width="10%" align="center"><asp:LinkButton ID="btnUpdate" runat="server" CommandName="Update" Text="Update" CssClass="navlink" /></td>
<td class="label2" width="10%" align="center"><asp:LinkButton ID="btnCancel" runat="server" CommandName="Cancel" Text="Cancel" CssClass="navlink" /></td>
</tr>
</edititemtemplate>
<footertemplate>
</table>
</footertemplate>

</asp:DataList>