-
Log On Script
Date: 08/13/06
Keywords: php, database, asp
When I was working with PHP, My log on script pretty much just queried the database with a SELECT and matched user id and password with what was submitted by the user.
How does this work in asp.net? Is there a better way?
I'm lost... thanks.
Source: http://community.livejournal.com/aspdotnet/73726.html
-
job opening
Date: 08/02/06
Keywords: programming, java, spam
A little off topic:
Anyone in the Houston area, or know anyone in the Houston area, looking for a Java or C# programming job? Experienced programmers only, please. This is not spam, my company works with both C# and Java, we need programmers with knowledge in either, or preferably both. If you are interested or know of someone who is please comment and I will send you my email address.
Thanks!
Source: http://community.livejournal.com/aspdotnet/73319.html
-
File Uploader with Progress Bar
Date: 07/26/06
Keywords: sql
If any one is looking for a file uploader that streams to disk or to sql server and offers a Progress bar
Neat Upload is what you are looking for.
Its Open Source and made with C#.
Source: http://community.livejournal.com/aspdotnet/73212.html
-
VB9 and C#3
Date: 07/18/06
Keywords: xml
I have briefly examined language specifications for VB9 and C#3. I am correct to think that only VB9 has Deep XML Support, Nested Extension Methods, Nullable Types, Relaxed Delegates, Strong “Duck Typing”? Also, it is the case that only C#3 has Lambda expressions, Implicitly Typed Arrays, and Expression Trees?
Source: http://community.livejournal.com/aspdotnet/72858.html
-
Retrieve from Sessions using C#
Date: 07/04/06
Keywords: asp
Hello everyone,
I'm currently working on a ASP.NET-project where I'm trying store a collection-class in the SessionState. Adding the class to the session is not any problem but retrieving it seems to be a whole different affair, which is why I've turned here for help.
Btw, I'm using C# for this project and switching to anything else is not an option.
The collection-class is named CUser and contains three strings and one byte, along with properties for these.
After having created an instance, usrInfo, of CUser I add it to the SessionState-object by:
Session.Add("userInfo",usrInfo):
Later on I'm trying to retrieve this object and from what I've read on MSDN it should be something like this:
CUser userInfo = Session["userInfo"];
However, it doesn't work. As I understand it the object in the SessionState is having some sort of identitycrizes and I'm clueless on how to go solve this in C#.
Any help will be appreciated. :)
Edit: Problem solved! Thanks anyway...
Source: http://community.livejournal.com/aspdotnet/72240.html
-
RegularExpression Help
Date: 06/30/06
Keywords: asp
I need to write a regularexpressionvalidator for my VB/ASP.Net page that requires the user put in at least 2 characters (and most 10), and the user needs to put in 1 letter and 1 number, however it doesn't need to be in any particular order, so some examples could be
a3
99393hhu3
3n05
1s2005h4
Also no "symbols" are allowed either. Anyone have any ideas? Thanks.
Source: http://community.livejournal.com/aspdotnet/72023.html
-
aspx inheritance woes
Date: 06/29/06
Keywords: asp, web
Want to see something wonderful? Fire up visual studio and start a new asp.net web application.
Make WebForm1.aspx look like this:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication1.child"%>
And make WebForm1.aspx.vb look like this:
Public Class parent
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Write("parent.Page_Load")
End Sub
End Class
Public Class child
Inherits parent
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Write("child.Page_Load")
End Sub
End Class
Press F5. The resulting page will only say "parent.Page_Load". If you go back and look at WebForm1.aspx, you will see that visual studio has changed "child" to "parent" for you! You can go ahead and change it back, but the next time you recompile, it will change it for you again!
Source: http://community.livejournal.com/aspdotnet/71780.html
-
more gridview woes
Date: 06/27/06
Keywords: no keywords
I have a mostly dynamic gridview. I have 2 columns that I've hard coded in. The rest are created on the fly.
The new problem is that when I update a row, my changes don't show unless I redo my select statement (since I don't have it bound using the built-in datasource functionality). After I redo my select statement getting the updated row, I bind the grid, and it shows up. However, it is appending to the original data since I binded the grid earlier before the update. (Since its all dynamic I have to repopulate the grid on every postback). So now all my columns are showing up twice.
Is there some way I can just set my dataSource, and have it update itself after I modify a row? Or a way to "unbind" the grid before I rebind it after the update?
XX posted
Thanks
Source: http://community.livejournal.com/aspdotnet/71478.html
-
Working with a bad database
Date: 06/22/06
Keywords: database, sql
I posted this in another group but got like no responses.
Ok so now that I have my unions and memory issues resolved, now I need to fix this screwed up data that I have in my database.
I have a badly created Document Control system that stores all the documents in the database in 2 tables: Current and Versioned (those are aliases.) Current obviously holds all the current documents and the Versioned table has all the old versions. The problem is though that not all the information corresponds with the correct records. For example, if you have 5 versions of a document, the version notes (which we use for ISO) for the most recent version (5) actually are associated with Version 4, along with the date it was submitted. Also, the original document version (1) has version notes and a submitted date with it as well, but obviously the first version can't have version notes so those are actually referring to the next version (2). If this sounds confusing its because it is. I don't know who designed this damn thing, but as a lesson let me say to NOT use Tribune's BMS content Management system for your document control because they don't do good database design and they blatantly steal their code from Wrox's "How to build an Intranet" book.
So anyways I need to figure out how to get these records to correspond to the correct versions, so basically every record actually refers to the next record. Also it should be noted that SOME of the information does correspond, so I only need to move information from certain fields, not the entire row.
SqlDataAdapter da = new SqlDataAdapter("SELECT d.mdItemID AS CurrentID, d.mdFileDescription AS CurrentFile, d.mdFileName as CurrentFileName, tblUser.usUserName AS Creator, " +
"d.mdCreatedDate AS OriginalDocDate, tblMics_Docs_Versions.mvSubItemID AS OldID, " +
"tblMics_Docs_Versions.mvFileName as OldFileName, usr2.usUserName as ModifiedBy, tblMics_Docs_Versions.mvNotes AS VersionNotes, " +
"tblDepartment.dpNAME AS DepartmentName, tblMics_Docs_Versions.mvVersionedDate AS sort_date " +
"FROM tblMics_Docs d INNER JOIN tblDepartment ON d.mdDepartmentID = tblDepartment.dpID " +
"INNER JOIN tblUser On d.mdCreatedByUserID = tblUser.usUserID JOIN tblMics_Docs_Versions ON d.mdItemID = tblMics_Docs_Versions.mvItemID " +
"INNER JOIN tblUser usr2 on tblMics_Docs_Versions.mvCheckedInByUserID = usr2.UsUserID " +
"WHERE d.mdArchived = 0 UNION " +
"SELECT d.mdItemID AS CurrentID, d.mdFileDescription AS CurrentFile, d.mdFileName as CurrentFileName, " +
"tblUser.usUserName AS Creator, d.mdCreatedDate AS SubmittedDate, null, null, null, null, tblDepartment.dpNAME, getdate() as sort_date " +
"FROM tblMics_Docs d INNER JOIN tblDepartment ON d.mdDepartmentID = tblDepartment.dpID " +
"INNER JOIN tblUser On d.mdCreatedByUserID = tblUser.usUserID JOIN tblMics_Docs_Versions ON d.mdItemID = tblMics_Docs_Versions.mvItemID " +
"INNER JOIN tblUser usr2 on tblMics_Docs_Versions.mvCheckedInByUserID = usr2.UsUserID WHERE d.mdArchived = 0 ORDER BY mdItemID ASC, sort_date ASC", con);
try
{
da.Fill(ds);
}
catch (Exception j)
{
j.ToString();
}
ds.Tables[0].Columns.Add("Version");
ds.Tables[0].Columns.Add("FileLocation");
Int16 currID;
int lastID = 0;
int VerNum = 1;
//This code below is used to add the version numbers to the documents because the CM system
//Doesn't keep track and just uses a Count statement in its SQL code.
foreach (DataRow dr in ds.Tables[0].Rows)
{
currID = System.Convert.ToInt16(dr["CurrentID"]);
if ( currID == lastID )
{
dr["Version"] = VerNum;
lastID = currID;
}
else
{
VerNum = 1;
dr["Version"] = VerNum;
lastID = currID;
}
if (dr["oldID"] == DBNull.Value )
{
dr["FileLocation"] = "BMS Current\\" + dr["DepartmentName"] + "\\" + dr["CurrentID"] + " Version " +
dr["Version"] + " " + dr["CurrentFileName"];
}
else
{
dr["FileLocation"] = "BMS Archive\\" + dr["DepartmentName"] + "\\" + dr["CurrentID"] + " Version " +
dr["Version"] + " " + dr["OldFileName"];
}
VerNum ++;
}
dg1.DataSource = ds.Tables[0];
ds.Tables.Add("files");
con.Close();
//con.Dispose();
ds.Dispose();
da.Dispose();
}
I can try and post pictures of this in action if that'll help. Unfortunately my SQL skills aren't that good and I haven't had alot of experience with datasets. Thanks.
RESOLVED: I gave up on trying to do this in SQL and instead implemented an array to store the inconsistent values and then put them in their correct places.
Source: http://community.livejournal.com/aspdotnet/71275.html
-
gridview
Date: 06/13/06
Keywords: no keywords
is it true i have to create my own gridViewTemplate class to dynamically add a template column to a gridview? nooooooooo
it used to be so easy with the datagrid. :(
Source: http://community.livejournal.com/aspdotnet/70618.html
-
Problem with a query
Date: 06/09/06
Keywords: database, asp, sql, web
My struggles continue.
Ok so I've been assigned the daunting task of setting up our documents to be sent to our new content management system from our current one which was written by a bunch of dumb brits who stole 80% of their code from Wrox. I need to bring out all the current and old documents. They are housed
in 1 database in 2 tables. All the current documents are in 1 table, and all their old versions are in the other. They use keys to communicate with each other, so every versioned document references the id of its current document. Also, not every current document has more than one version, so not every document in the current table has a corresponding record in the old table (the information in these tables is not totally consistent either, but that's a whole other issue that I'm not delving into now.)
The problem I'm having is that while my query will return all versioned records and current records WITHOUT any subsequent versions, it does NOT return the most current record of the versions. What I mean is that if there is four versions of a document, 3 of the documents are in the old table and 1 (the current version) is in the current table. My query only returns the 3 from the old table, and not the most recent one which resides on the current table.
My query looks like this. Some of the information is extraneous. The bold part is the main function I feel refers to this.
SELECT d.mdItemID AS CurrentID, d.mdFileDescription AS CurrentFile, d.mdFileName as CurrentFileName, d.mdCreatedByUser AS Creator, d.mdCreatedDate AS SubmittedDate,
tblMics_Docs_Versions.mvSubItemID AS OldID, tblMics_Docs_Versions.mvVersionedDate AS VersionedDate,
tblMics_Docs_Versions.mvFileName as OldFileName, tblMics_Docs_Versions.mvNotes AS VersionNotes,
tblDepartment.dpNAME AS DepartmentName FROM tblMics_Docs AS d INNER JOIN
tblDepartment ON d.mdDepartmentID = tblDepartment.dpID LEFT OUTER JOIN tblMics_Docs_Versions ON
d.mdItemID = tblMics_Docs_Versions.mvItemID
WHERE d.mdArchived = 0 ORDER BY mdItemID ASC, VersionedDate ASC
tblMics_Docs is the current table, tblMics_Docs_Versions is the old table.
People have suggested using temp tables or a UNION command to fix this issue, but the problem is that I got a 2.5 in SQL in college and its not my strong suit.
This is for a program that's being written in C# and binding to a datagrid (the webform version, NOT the ASP.Net version.) I figured this would be a good place to ask this question. If anyone could help me with this it would be greatly appreciated. Thanks.
Source: http://community.livejournal.com/aspdotnet/70280.html
-
Creating random directories in VB.NET
Date: 06/02/06
Keywords: html, asp, security, web
Hi folks...long time reader, first time poster.
I have a piece of code that SHOULD be working. It is simple and straight forward, creating a directory.
The code:
Dim tmpfldr As String = secret.buildFLDR() ' Build a 10 character, semi random string for a DIR Name
'This is the URL that will be used to create the links
targetfullpath = "http://" & cfg.serverURL & "/" & cfg.RootDBFolder & "/" & tmpfldr
filesysfullpath = cfg.filesysFLDR & "\" & cfg.RootDBFolder & "\" & tmpfldr
Me.lblUploadStat.Text = Me.filesysfullpath
'filesysfullpath = "\" & tmpfldr
Dim tdir As DirectoryInfo
Dim usr As String = "Current executing thread is " + System.Security.Principal.WindowsIdentity.GetCurrent().Name
Try
If Directory.Exists(filesysfullpath) = False Then
' Create the directory.
Directory.CreateDirectory(filesysfullpath)
....
It gets to this line and throws an error:
System.IO.DirectoryNotFoundException: Could not find a part of the path "e:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at System.IO.Directory.CreateDirectory(String path) at mjbears.drpbox.loadcfg() in C:\Documents and Settings\Jim\VSWebCache\sandbox.pixieproductions.com\default.aspx.vb:line 100
The "filesysfullpath" resolves out to "e:\web\public_html\username\sandbox\dropbox\BUILDFLDR" where BUILDFLDR is the random string. I have read/write privileges in "dropbox" folder, so I should be able to write/create a directory there.
Help! I've been hacking on this code for hours!
Peace,
Bear
Source: http://community.livejournal.com/aspdotnet/69908.html
-
Classes and Include Files
Date: 05/31/06
Keywords: asp, sql, web
I am new to ASP.NET... jumping on board with 2.0.
I am from a VBScript ASP Background the last 6 years.
Here is my problem, in the past when I needed to reuse some code I just popped her into an include file and kept using it over and over again.
Now that I am in ASP.NET, I am attempting to teach myself how to use a Class file or determine the correct way of doing what I had done in the past, but so far I have yet to A) Make it work and/or B) Find documentation.
I grabbed 2 separate books on ASP.NET and they only gloss over the uses of Class files. On the other hand they were immensely instrumental with getting me almost up to speed.
For instance, I want to reuse a connection string and SQL Statement in various areas of a project. I want to declare this somehow 1 time and then call it in all of my Subs or Functions that need it. Sure ASP.NET 2.0 will allow me to do this with the GridView and the Web.Config file, but I am really looking to avoid this.
I have TONS of classic ASP pages I need to, over time, fix up and port to ASP.NET and it would help if I have much of the work done, by eventually pointing them to this 1 file.
Any links that someone can post would be a massive help.
I am also looking for documentation on how to use Master Pages.
Thank you again.
Source: http://community.livejournal.com/aspdotnet/69254.html
-
.ASMX
Date: 05/31/06
Keywords: software, xml, database
I’ve been challenged at my work to develop something on the order of a mobile helpdesk.
We run clientele as our helpdesk software, not that it’s important but it’s pretty popular.
Also my department just got new Windows Mobile devices and I’m been exploring different ways to use them and I’m looking into being able to view a database remotely.
Is it possible to extend a database view with ASMX is that what ASMX does, or should I be looking at straight XML for just simply viewing a remote database table.
Source: http://community.livejournal.com/aspdotnet/69025.html
-
Grid Views are ugly.
Date: 05/28/06
Keywords: css, database
My data presentation needs help. I have a simple SELECT to grab data from my database and that works well. The data I have being presented in a gridview needs something more. In my searching I can’t seem to find how to apply CSS to the gridview. Is that possible?
I want to have full control over the spacing, colors margins and padding, as well as the data inside. I wish to have the gridview in a more linier view and not locked to an excel looking horizontal display.
I'm making a simple blog so I want the format..
Subject
Body of the post
Time and date / username
thanks
Source: http://community.livejournal.com/aspdotnet/68808.html
-
2.0 postbacks
Date: 05/25/06
Keywords: sql, microsoft
Ok, so I have a reset button on my page and I am rerunning my sql queries and everything to get the original values back into the textboxes the user is allowed to modify. At first, I was calling my sql queries in the page_load event when they clicked reset. Even though I was resetting all the values of the textboxes, and these textboxes are created dynamically, it was keeping the modified user values. When I moved my sql calls to the reset button event handler, and put an ispostback check into my page_load, it then reverted back to the original values and worked the way i wanted it to.
This is really weird. If you are reloading your page completely, why would it hang on to the modified values?
Now I have a save button that I want to click and be able to get all the new values. But if I put it in my event handler, I will get the old values, just like when I click reset. Damn you microsoft....
Source: http://community.livejournal.com/aspdotnet/68561.html
-
Sorting by userID
Date: 05/25/06
Keywords: sql, security
I'm trying to sort by domain user id, I can pull the user id fine but now I want to sort my SELECT by that name. How do I put the value of getUserIdentity into my SELECT statment.
Thanks
protected string getUserIdentity()
{
return HttpContext.Current.User.Identity.Name.ToString().Replace("DOMAIN\\", "");
}
protected void Page_Load(Object sender, EventArgs e)
{
username = getUserIdentity();
SqlConnection myConnection = new SqlConnection("Data Source=CLIENTELE;Initial Catalog=forms;Integrated Security=True");
SqlDataAdapter myCommand = new SqlDataAdapter("SELECT * FROM formTable WHERE userID = @username ORDER BY status DESC", myConnection);
DataSet ds = new DataSet();
myCommand.Fill(ds, "names");
MyDataGrid.DataSource=ds.Tables["names"].DefaultView;
MyDataGrid.DataBind();
}
Source: http://community.livejournal.com/aspdotnet/68149.html
-
AJAX AutoComplete Control with Source Code
Date: 05/25/06
Keywords: asp, google
I created a Control that contains a textbox that does autocomplete similar to Google Suggest. It's written in C# for ASP.NET 2.0. It's free to use, open source and pretty well documented.
Get more information including download instructions, or check out a demo.
Source: http://community.livejournal.com/aspdotnet/67872.html
-
user controls and weird shit
Date: 05/25/06
Keywords: java, web
Hi,
I am dynamically loading a user control onto my web form. My web form has a few buttons on it. These buttons are not firing their onclick events, they aren't even doing a postback. When I go to view source, I see this:
***onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("cmdTopSave", "", true, "", "", false, false))"***
I looked at some other pages that used user controls and they had the same thing. My pages without user controls do not contain the above code. I am assuming the reason my button click events are not doing a server side postback is because the onclick event is wired to this javascript function.
Does anyone know why this function is wired to my onclick event? How to override/delete it so that I can have a normal server postback??
Thanks.
Source: http://community.livejournal.com/aspdotnet/67808.html
-
Force Response.OutputStream to open application
Date: 05/23/06
Keywords: browser, database, asp, microsoft
Ok here's the situation. I have an ASP.net app that gets a file from a database and then prompts the user to run, saveAs, or cancel the file. The code is:
Response.Buffer = True
Response.AddHeader("Content-Disposition", "inline;filename=" & ds.Tables(0).Rows(0).Item("reqJobDescName"))
Response.ContentType = "application / msword"
Response.BinaryWrite(myData)
The problem is that if you click on Run, the file opens up in another browser. I want it to be opened by the actual program. Therefore, I don't want this to "run" on another browser window that has Microsoft Word in it. I want Microsoft Word to open up the file directly. Is there any way to do this? I have to figure there is, although perhaps it can't be done in Response since that is all based on httpResponse. Thanks.
Source: http://community.livejournal.com/aspdotnet/67367.html