UpdateCommand = "UPDATE Resident SET FNAME=@FNAME, LNAME=@LNAME, MobileNum=@MobileNum, HomeNum=@HomeNum, OfficeNum=@OfficeNum, FaxNum=@FaxNum WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum HomeNum=@original_HomeNum
AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum"
InsertCommand = "INSERT INTO Resident FNAME, LNAME, MobileNum, HomeNum, OfficeNum, FaxNum VALUES ( '@FNAME', '@LNAME', '@MobileNum', '@HomeNum', '@OfficeNum', '@FaxNum') WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum
HomeNum=@original_HomeNum AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum"
DeleteCommand = "DELETE Resident WHERE FNAME=@FNAME, LNAME=@LNAME, MobileNum=@MobileNum, HomeNum=@HomeNum, OfficeNum=@OfficeNum, FaxNum=@FaxNum WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum HomeNum=@original_HomeNum
AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum" >
Veschich
Member
29 Points
279 Posts
Re: Unable to make connection to database?
Aug 19, 2010 08:21 AM|LINK
Wow. No. Still the sameee. I don't. Here's what is in the aspx. ( Part of it of course )
<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"><asp:SqlDataSource ID="ResidentDetails" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:ThisIsMyConnection%>" </div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> SelectCommand = "SELECT * FROM Resident "</div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> UpdateCommand = "UPDATE Resident SET FNAME=@FNAME, LNAME=@LNAME, MobileNum=@MobileNum, HomeNum=@HomeNum, OfficeNum=@OfficeNum, FaxNum=@FaxNum WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum HomeNum=@original_HomeNum AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum"</div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> InsertCommand = "INSERT INTO Resident FNAME, LNAME, MobileNum, HomeNum, OfficeNum, FaxNum VALUES ( '@FNAME', '@LNAME', '@MobileNum', '@HomeNum', '@OfficeNum', '@FaxNum') WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum HomeNum=@original_HomeNum AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum"</div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> DeleteCommand = "DELETE Resident WHERE FNAME=@FNAME, LNAME=@LNAME, MobileNum=@MobileNum, HomeNum=@HomeNum, OfficeNum=@OfficeNum, FaxNum=@FaxNum WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum HomeNum=@original_HomeNum AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum" ></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <UpdateParameters></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="FNAME" Type="String" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="LNAME" Type="String" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="MobileNum" Type="Int32" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="HomeNum" Type="Int32" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="OfficeNum" Type="Int32" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="FaxNum" Type="Int32" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </UpdateParameters></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <InsertParameters></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="FNAME" Type="String" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="LNAME" Type="String" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="MobileNum" Type="Int32" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="HomeNum" Type="Int32" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="OfficeNum" Type="Int32" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="FaxNum" Type="Int32" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </InsertParameters></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <DeleteParameters></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:Parameter Name="FNAME" Type="Int32" /> </div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </DeleteParameters></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </asp:SqlDataSource></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <br /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:GridView ID="GridView1" runat="server" </div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> AutoGenerateColumns="True" PageSize="10" AllowPaging="True" </div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> style="font-family: Verdana" Visible="False"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <Columns></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:BoundField DataField="FNAME" HeaderText="First Name" SortExpression="FNAME" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:BoundField DataField="LNAME" HeaderText="Last Name" SortExpression="LNAME" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:BoundField DataField="MobileNum" HeaderText="Mobile Number" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:BoundField DataField="HomeNum" HeaderText="Home Number" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:BoundField DataField="OfficeNum" HeaderText="Office Number" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:BoundField DataField="FaxNum" HeaderText="Fax Number" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:CommandField ShowEditButton="True" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:CommandField ShowDeleteButton="True" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> <asp:CommandField ShowInsertButton="True" /></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </Columns></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"> </asp:GridView></div><asp:SqlDataSource ID="ResidentDetails" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:ThisIsMyConnection%>"
SelectCommand = "SELECT * FROM Resident "
UpdateCommand = "UPDATE Resident SET FNAME=@FNAME, LNAME=@LNAME, MobileNum=@MobileNum, HomeNum=@HomeNum, OfficeNum=@OfficeNum, FaxNum=@FaxNum WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum HomeNum=@original_HomeNum AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum"
InsertCommand = "INSERT INTO Resident FNAME, LNAME, MobileNum, HomeNum, OfficeNum, FaxNum VALUES ( '@FNAME', '@LNAME', '@MobileNum', '@HomeNum', '@OfficeNum', '@FaxNum') WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum HomeNum=@original_HomeNum AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum"
DeleteCommand = "DELETE Resident WHERE FNAME=@FNAME, LNAME=@LNAME, MobileNum=@MobileNum, HomeNum=@HomeNum, OfficeNum=@OfficeNum, FaxNum=@FaxNum WHERE FNAME=@original_FNAME AND LNAME=@original_LNAME AND MobileNum=@original_MobileNum HomeNum=@original_HomeNum AND OfficeNum=@original_OfficeNum AND FaxNum=@original_FaxNum" >
<UpdateParameters>
<asp:Parameter Name="FNAME" Type="String" />
<asp:Parameter Name="LNAME" Type="String" />
<asp:Parameter Name="MobileNum" Type="Int32" />
<asp:Parameter Name="HomeNum" Type="Int32" />
<asp:Parameter Name="OfficeNum" Type="Int32" />
<asp:Parameter Name="FaxNum" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="FNAME" Type="String" />
<asp:Parameter Name="LNAME" Type="String" />
<asp:Parameter Name="MobileNum" Type="Int32" />
<asp:Parameter Name="HomeNum" Type="Int32" />
<asp:Parameter Name="OfficeNum" Type="Int32" />
<asp:Parameter Name="FaxNum" Type="Int32" />
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="FNAME" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
<br />
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="True" PageSize="10" AllowPaging="True"
style="font-family: Verdana" Visible="False">
<Columns>
<asp:BoundField DataField="FNAME" HeaderText="First Name" SortExpression="FNAME" />
<asp:BoundField DataField="LNAME" HeaderText="Last Name" SortExpression="LNAME" />
<asp:BoundField DataField="MobileNum" HeaderText="Mobile Number" />
<asp:BoundField DataField="HomeNum" HeaderText="Home Number" />
<asp:BoundField DataField="OfficeNum" HeaderText="Office Number" />
<asp:BoundField DataField="FaxNum" HeaderText="Fax Number" />
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />
<asp:CommandField ShowInsertButton="True" />
</Columns>
</asp:GridView>
Here's what is in the aspx. cs:
protected void Button1_Click(object sender, EventArgs e)
{
GridView1.Visible = true;
GridView1.DataSource = ResidentDetails;
GridView1.DataBind();
}
And look what it show in browser: http://dox.bg/files/dw?a=604f917f7f
So i guess when click on the button to show me all data from the database( SelectCommand = "SELECT * FROM Resident "). But not.