Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
B

Bill Priess

@Bill Priess
About
Posts
19
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Block scope when using 'using' statement.
    B Bill Priess

    Got it.. thanks for the assist. Unfortunatly, I have to worry about early disposal of my objects because I am running this on a shared server in the company and I need to really, really, REALLY manage my memory usage (***sigh grumble***)... Thanks Heath... :) Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    C# database c++ tutorial question announcement

  • Block scope when using 'using' statement.
    B Bill Priess

    Hey Heath, Thanks for the quick reply... but... ;) According to the docs: selectCommandText A String that is a Transact-SQL SELECT statement or stored procedure to be used by the SelectCommand property of the SqlDataAdapter. I forgot to put in the fact that I use sda.SelectCommand.CommandType = CommandType.StoredProcedure. Anyhow... I've tried it a number of different ways, all with the same problem.. the DataTable never has rows in it. I understand what you are saying, but, if the data adapter gets disposed *after* the fill, why would the data table still return no rows? I did this and had the same results. public static DataTable getTable() { DataTable dt = new DataTable("table"); using (Config config = new Config()) //custom configuration class. { using (SqlConnection conn = new SqlConnection(config.SqlConnectionString)) { using (SqlDataAdapter sda = new SqlDataAdatper("Select * from table", conn)) { sda.Fill(dt); } } } return dt; } return dt; Now, from what I have read about the using statement, this pretty much translates to: public static DataTable getTable() { DataTable dt = new DataTable("table"); Config config = new Config(); try { SqlConnection conn = new SqlConnection(config.SqlConnectionString); try { SqlDataAdapter sda = new SqlDataAdapter(SqlDataAdatper("Select * from table", conn)); try { sda.Fill(dt); } finally { if (sda!= null) ((IDisposable)sda).Dispose(); } } finally { if (conn!= null) ((IDisposable)conn).Dispose(); } } finally { if (config != null) ((IDisposable)config).Dispose(); } return dt; } Believe it or not, when I run that code above, as is, it works fine. My table is populated and everyone is happy. Sorry to carry on, I am just trying to figure out the scope usage that MS wrote into the using statement. Any ideas? TIA, Bill P. Oakland, CA * * * -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK----- * * *

    C# database c++ tutorial question announcement

  • Block scope when using 'using' statement.
    B Bill Priess

    Hey gang, Ok, I'm stumped on this one... I am using the using statement to wrap a SqlDataAdapter that I am using to fill a DataTable. Now, what I need to know is, just how much block-scope applies to objects created in the using scope. For example: static DataTable getTable() { using (SqlDataAdapter sda = new SqlDataAdapter("StoredProcedure", new SqlConnection("ConnectionString"))) { DataTable dt = new DataTable("table"); sda.Fill(dt); return dt; } } I know this would return a table with zero rows becuase it is created and destroyed within the scope of the using statement. But... static DataTable getTable() { DataTable dt = new DataTable("table"); using (SqlDataAdapter sda = new SqlDataAdapter("StoredProcedure", new SqlConnection("ConnectionString"))) { sda.Fill(dt); } return dt; } Now, when I call this, I also get back zero rows in my table, yet when I run the query in SQL, it comes back fine. Anyone have any ideas or experience with the using statement? TIA, Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    C# database c++ tutorial question announcement

  • Write Binary Files to the Browser
    B Bill Priess

    You're right, not the greatest of solutions, but if it works, it works. :) I think that Adobe has really messed up with the newer acrobat versions. With the web update not auto-timing out and invisible windows, it's a wonder why GhostScript hasn't taken off.. ;) Well, anyhow, great job on the solution, sorry I couldn't be more help! HTH, Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    ASP.NET question

  • Frames & Redirection
    B Bill Priess

    Ahhh... the joys of working with frames and postback events. Ok, here is your solutions: 1. Get rid of the frames! j/k ;) 2. use client-side javascript: function Change(url1, url2) { top.frames['Contents'].location.href = url1; top.frames['Main'].location.href = url2; } Then, in your events in the code-behind: Page.RegisterStartUpScript("change","Change('http://localhost/contents.aspx','http://localhost/main.aspx');"); 3. Create your links and controls dynamically in the code-behind, and then inject them into your pages with the appropiate attributes (OnClick, TARGET). HTH, Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    ASP.NET help csharp html question

  • Write Binary Files to the Browser
    B Bill Priess

    Ok, one last thing that I can think of... have you tried it from other client machines and/or another web server? Also, what version of the Framework are you using? I tried to recreate the problem here, and I cannot. I do get the exception, but my pdfs transfer just fine. HTH, Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    ASP.NET question

  • Write Binary Files to the Browser
    B Bill Priess

    Hmmm, not sure what would be going on. Have you checked other things like file permissions and such? HTH, Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    ASP.NET question

  • Is Oracle really so much faster than MS Sql
    B Bill Priess

    Mike Dimmick wrote: Frankly, SQL Server usually performs well enough on almost any hardware. Oracle really requires massive amounts of memory - 9i couldn't create a database on our test system with 192Mb (taking 6 hours and then the client crashed), while SQL Server 2000 creates a new database in about 5 seconds on the same hardware. Not to mention, SQL Server is organized in such a way as to make it easy for "non-sql" people to use. With the different flavors (MSDE, Standard, Developer, and Enterprise), you can really get just what you need without the tons of overhead that Oracle requires. Also, with Oracle, from around 7.0.4 and above, you basically need at least a week of classes just to figure out the whole Scott/Tiger thing and how to get the DB up and running. That does not include performance tuning, backups or how and why the data dictionary works. Mike Dimmick wrote: Basically, you need to decide what you're going to use your system for (transaction processing versus ad-hoc queries), decide what performance level you actually need (i.e. how many transactions per second you're planning to handle). The performance of your system will also depend very much on how you write your queries and implement your indexes. We did a lot of performance testing on both Oracle 9i and Sql Server 2K. We found that when it came to data warehousing (large queries, mostly static indexes and a lot of tables!), Oracle was best. When it came to more transactional queries, Sql Server was top notch. Plus, given that .NET is tailored to Sql Server (go figure!), there is an added performance boost... ;) Ok, enough of my rambling... :zzz: Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    Database database java sql-server oracle sysadmin

  • Write Binary Files to the Browser
    B Bill Priess

    In looking at that, and also what I know about the ThreadAbortException, I would say that it seems, from the code, that it works correctly. Whenever you do a Response.End() or a Response.Redirect(), a ThreadAbortException is thrown. This is normal behavior. But, you might try this method: From MSDN String FileName; FileStream MyFileStream; IntPtr FileHandle; long StartPos = 0, FileSize; FileName = "c:\\temp\\Login.txt"; MyFileStream = new FileStream(FileName, FileMode.Open); FileHandle = MyFileStream.Handle; FileSize = MyFileStream.Length; ... Response.WriteFile(FileHandle, StartPos, FileSize); MyFileStream.Close(); It might work a bit better, either that, or, provide a link for the user to click on to download the pdf themselves. At a minimum, I would wrap a try catch around the code and see what is going on aside from the ThreadAbortException. Soemthing like this: try { ... downloading code here } catch(ThreadAbortException tex) { ... do nothing here, we don't care about the exception, we just don't want to throw it. } catch(Exception ex) { ... see what other exceptions might be creeping up... } Also, on another thought, it could possibly be Acrobat that is causing the problem. With the WriteFile, the file itself is written into the response stream. Now, I know on my machine, when I download a pdf and view it in the browser, the Acrobat OCX always wants to check for a newer version and will hang my browser at times. MAybe something like this is happening? HTH, Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    ASP.NET question

  • How to send information to a message queue
    B Bill Priess

    Hmmm, is the queue an authenticated queue? try turning off authentication on the queue and then see what happens. HTH, Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    ASP.NET data-structures tutorial

  • How to send information to a message queue
    B Bill Priess

    It looks like to me that you are trying to do it in client-side script. Is this correct? If that is the case, then I believe that you need to make sure that the MACHINENAME\IUSR_MACHINENAME account needs to have access to the queue, which I have heard is not a good idea. If you are using ASP.NET, then I would send and recieve the messages in the code-behind and do it that way. Much safer, IMHO. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmessagingmessagequeueclassreceivetopic.asp This is what I found on MSDN for receiving a message. HTH, Bill P. Oakland, CA


    -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCM/MU/B dpu s--:-- a32 C++++$ ULH+++ P+++ L++ E+ W+++$ N++ o K? w++++$ O-- M V-- PS+ PE+ Y++ PGP++ t++@ 5++@ X++ R+@ tv b++ DI++ D+++>++++ G++ e++ h---- r+++ y++++ -----END GEEK CODE BLOCK-----


    ASP.NET data-structures tutorial

  • Context.User.Identity issue??
    B Bill Priess

    mittalpa wrote: Thanks Bill. Well, If we still use Session variable, instead Context.User.Identity.IsAuthenticated, then it does. Doesn't it? Nope... The Context.User.Identity is a System.Security.Principal.IIdentity object. It is not stored in session. Using Session state variables in your app will not invalidate your Forms authentication at all. But that is more O/T... ;) Gald I could be of assitance :) HTH, Bill P. Oakland, CA

    ASP.NET csharp asp-net database sql-server

  • Problem with html attribute width=100%
    B Bill Priess

    One other thing that you might want to try is setting the rightmargin attribute of your body tag to "0". HTH, Bill P. Oakland, CA

    Web Development help question html database sysadmin

  • How to send information to a message queue
    B Bill Priess

    To accomplish this, you need to use the System.Messaging namespace. The process is fairly simple to use and implement. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmessaging.asp HTH, Bill P. Oakland, CA

    ASP.NET data-structures tutorial

  • Context.User.Identity issue??
    B Bill Priess

    What you could do is test to see if the user is authenticated: Label1.Visible = Context.User.Identity.IsAuthenticated; Also, just as a side question, how will using Session variables defeat the purpose of Forms Authentication? HTH, Bill P. Oakland, CA

    ASP.NET csharp asp-net database sql-server

  • About images convertion
    B Bill Priess

    I'm not totally sure if this will work (Graphics are not my strong point), but give it a shot: System.Drawing.Bitmap b = new System.Drawing.Bitmap("filename.bmp"); System.IO.MemoryStream ms = new System.IO.MemoryStream(); b.Save(ms, System.Drawing.Imaging.ImageFormat.Wmf); System.Drawing.Imaging.Metafile m = new System.Drawing.Imaging.Metafile(ms); I'm sure other people will have a better solution, but I think that will get you started. ;) HTH, Bill P. Oakland, CA

    C# csharp learning

  • Assign the same value to two or more controls at the same time
    B Bill Priess

    There is a slightly easier way without having the overhead of creating a composite control. Add a PlaceHolder to your page. Then, in the code behind: protected System.Web.UI.WebControl.PlaceHolder plHolder; private void Page_Load(object Sender, EventArgs e) { using (Label lbl = new Label()) { lbl.Text = someVariable; plHolder.Control.AddAt(0, lbl); } using (LiteralControl lc = new LiteralControl()) { lc.Text = someVariable; plHolder.Control.AddAt(1, lc); } } This should acheive the results that you want without a lot of overhead. :) HTH, Bill P. Oakland, CA

    ASP.NET csharp asp-net com help question

  • Server Error in '/' Application
    B Bill Priess

    Are you using Visual Studio.NET for your development environment? If so, then what you need to do is: 1. Delete the FrontPage web on the server. ASP.NET apps do not use FP extensions. 2. Open up Visual Studio.NET and create a new web project. In the "Location" field, enter in the name of the web server that you are creating the project on and the name of the project. 3. Hit OK. Visual Studio.NET will take care of creating the virtual directory for you and assign it the settings that it needs to run as an ASP.NET app. That's it! HTH, Bill P. Oakland, CA

    ASP.NET help question sysadmin windows-admin

  • what troubles???
    B Bill Priess

    When trying to delete a file from a shared folder, you have to take into account permissions on that folder. Especially if it is on a NTFS volume. One way to get around it is to give the ASPNET account read/write permissions to the shared folder. Otherwise, you will have to impersonate an actual (or created) account that has rights to read/write from the shared folder. [^<identity> Element] HTH, Bill P. Oakland, CA

    ASP.NET help tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups