for xml explicit
NULL AS parent,
user_id AS [li!1!title],
name AS [li!1]
FROM t_users
FOR xml explicit
comes out as:
Debugging Classic ASP in VS08
1. Go to Control Panel>Administrative Tools>Computer Management. Add IWAM_ComputerName account to the Debugger Users group.
2. Create a Web Application Project in VS 2005 and add .asp files.
3. Create a virtual directory in IIS for the web application project that you created.
4. On the properties tab of the virtual directory in IIS do the following:
1. Click Configuration button.
2. On the Mappings tab, select .asp and click Edit
3. Add the DEBUG verb and click OK.
4. Go to Debugging tab.
5. Enable the ASP debugging and Client Side Debugging
5. Load the web application project and set the breakpoint in the ASP.
6. In VS 2005, go to Debug > Attach to Process. (make sure you Attach to Script Code)
7. Select the DLLHost process that runs under the IWAM_ComputerName account.
8. Load the .asp file in the browser and break point will bind now.
useful SQL queries
Find all users that are in tblUser table but are not in tblTransaction (very useful if there’s a foreign key issue)
Now this one is used when you have a table linking a many to many relationship. This query pulls all currently assigned individuals and the event countries they are assigned to:
FROM tblEventContact t1, tblContact t2, tblEvent t3
WHERE t2.id = t1.contact_id
AND t3.id = t1.event_id
SELECT FIRST_NAME, COUNTRYFROM tblEventContact t1, tblContact t2, tblEvent t3where t2.id = t1.contact_idand t3.id = t1.event_id
Migrating and Encrypting
getOldUsers – read the ds one by one from the old db, where the passwords are not yet encrypted.
InsertUserx – writes the users into your new (current) db, with passwords encrypted.
Dim dr As DataRow
Dim ds As DataSet
Dim dt As DataTable
Dim userID As Integer
ds = getOldUsers()
dt = ds.Tables(0)
For Each dr In dt.Rows
newPass = Encrypt(password)
userID = InsertUserx(dr("id"), "", dr("name").ToString, "", dr("lastName").ToString, dr("email").ToString, "", newPass , dr("address").ToString)
Next
ds.Dispose()
Return userID
End Function
A more recent version of the file has been saved….
OMG. the following message has been popping up more and more often when using FTP via VS08, and the larger the project gets the more “No”s you have to click….
A more recent version of the file [filename] has been saved to the Web server by [username] on [DateTime]
Do you want to replace the server file with your local file?
Yes/No
the workaround is as follows:
delete cached project files from:
For Vista:-
C:\Users\%username%\AppData\Local\Temp\VWDWebCache\
For XP:-
C:\Documents and Settings\%username%\Local Settings\Temp\VWDWebCache\
Voila!
Return Inserted Identity from Stored Procedure
Stored Procedure looks like this:
@txtName varchar(255),
@txtDisplayName varchar(80),
@txtPhone varchar(50)
AS
BEGIN
INSERT INTO tblSomeTable
(
txtName ,
txtDisplayName ,
txtPhone
)
VALUES
(
@ txtName ,
@ txtDisplayName ,
@ txtPhone
)
SELECT NEWID = SCOPE_IDENTITY()
END
.NET Repeaters Cheat Sheet (vb)
create the repeater
<ItemTemplate>
<asp:Label ID="lblQuestion" runat="server"></asp:Label>
<asp:Label ID="lblQID" visible="false" runat="server"></asp:Label>
<br />
<asp:RadioButtonList ID="answer" runat="server"Â >
<asp:ListItem Text="True" Value="T" ></asp:ListItem>
<asp:ListItem  Text="False" Value="F"></asp:ListItem>
</asp:RadioButtonList>
<hr />
</ItemTemplate>
</asp:Repeater>
back end code:
A few useful things to remember…
App_Offline.htm
“The way app_offline.htm works is that you place this file in the root of the application. When ASP.NET sees it, it will shut-down the app-domain for the application (and not restart it for requests) and instead send back the contents of the app_offline.htm file in response to all new dynamic requests for the application. When you are done updating the site, just delete the file and it will come back online.
One thing I pointed out in the talk that you want to keep an eye on is a feature of IE6 called “Show Friendly Http Errors”. This can be configured in the Tools->Internet Options->Advanced tab within IE, and is on by default with IE6. When this is on, and a server returns a non HTTP-200 status code with less than 512 bytes of content, IE will not show the returned HTML and instead substitutes its own generic status code message (which personally I don’t think is super friendly <g>).
So if you use the app_offline.htm feature, you should make sure you have at least 512 bytes of content within it to make sure that your HTML (instead of IE’s friendly status message) shows up to your users. If you don’t want to have a lot of text show-up on the page, one trick you can use is to just add an html client-side comment with some bogus content to push it over 512 bytes.”
http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx
Visual Studio 2005 Remote Debugger
I’ve had to do it 2 times so far, and each time i do it i have issues, which could be eliminated, if I saved my notes from the first time. so here goes.
1. from the Visual Studio CD, browse to tools -> remote debugger -> pick the right format and (x86 or x64) and install
2. leave the username as “LocalSystem”, password blank
3. in the IIS manager, right click on the virtual directory, Properties-> Directory Security -> Authentication and access control -> make sure Integrated Windows authentication is checked!!!!
NOTE: don’t forget one must also have FileZilla server, or any other ftp server, installed on the IIS Server to move/save/manipulate files.
yeay!
Meeeeooooooooowwwwwwww
a story of a miniature schnauzer
i should be getting the puppy sometime next week, but here is a little introduction: