Configuring Visual Studio to Debug .NET Framework Source Code

As I don’t like to reference blogs…they have a tendancy to disappear…so
 

This post (hopefully!) contains everything you need to know.  Over the past few weeks, we ran a pilot of this feature and collected lots of great data that helped us work through some issues and understand where people were likely to have problems. 

First, though, if you have any problems, please make sure you’ve followed all of the steps exactly as described.  If you’re still having problems, please check the FAQ/Troubleshooting section at the bottom.  If that doesn’t work, post a comment below and I’ll look into it.

BASIC SETUP

Note this functionality is not available on the Express versions of the Visual Studio 2008 products.

1) Install the Visual Studio 2008 QFE.  This Hotfix just updates a DLL that’s part of the Visual Studio debugger that fetches the source files, more details on the download page.

 UPDATE:  If you get an error installing the Hotfix , try inserting your VS 2008 DVD and then running the Hotfix EXE again.  We’re looking into the root cause – it’s related to having a prior version of VS 2008 (e.g. Beta 2) installed on the machine.  But this workaround should allow the Hotfix to install properly.

 UPDATE (1/18): There were some problems with the QFE link above that have been addressed, sorry for the inconvenience, it’s fixed now.

2) Start Visual Studio 2008 and bring up Tools > Options > Debugging > General.  If you are running under the Visual Basic Profile, you will need to check the box on the lower left of the Options Dialog marked "Show All Settings" before continuing (other profiles won’t have this option).

Set the following two settings:

  • Turn OFF the "Enable Just My Code" setting
  • Turn ON the "Enable Source Server Support" setting

Your settings should be as below:

image

3) Next, bring up the "Symbols" Page and set the symbols download URL and a cache location.  Specifically, set the three settings below:

    • Set the symbol file location to be: http://referencesource.microsoft.com/symbols
    • Set a cache location.  Make sure this is a location that your account has read/write access to.  A good option for this is to place this path somewhere under your user hive (e.g. c:\users\sburke\symbols)
    • Enable the "Search the above locations only when symbols are loaded manually" option.

When you’re finished, the settings should look like the image below:

image

Setup is done!  That’s it, really!

DEBUGGING INTO FRAMEWORK SOURCE

For this simple example, we’ll start with a blank C# Windows Application project, but it will work the same with a VB, Web, or WPF project.  To walk through this, go ahead and create that project.

Set a breakpoint in Form_Load:

image 

Now run your project to hit that breakpoint and go to your Call Stack window (CTRL+ALT+C).  In the Call Stack, right click a frame that starts with System.Windows.Forms.dll, and choose "Load Symbols".  This will load the symbols for the System.Windows.Forms assembly, which are about 10 megabytes, so the speed of the download will vary according to your connection speed.  Note that Visual Studio may be unresponsive during this time.   However, this download is a one-time cost for each assembly.  The symbols (PDB) file will be cached on your machine, in the directory specified in the steps above. 

Loading Symbols Manually

This will load the symbols for the DLL from the server, and you’ll see some information in the status bar to reflect this.  Note that when this completes, the call frames will turn black and line numbers will be available.  Note you’ll need to do the Right Click -> Load Symbols step each time you launch a debugging session (but, again, the symbols will now be cached locally so they won’t have to download).  For more information on this, see the ADVANCED USERS section below.

image

You have now loaded the symbols for the Windows Forms DLL and can begin viewing the code.  You can view code in any way that you normally would in a debugging session.  In this case you can either Step In to the line of code above, or you can double-click one of the frames in the Call Stack Window.   For this case, we’ll step in (F11).

The first time you step into code, we’ll be presented with the EULA for accessing the source code.  Please take the time to read this EULA.  If you agree to the terms of the EULA, hit ACCEPT, and the source will then be downloaded.

That’s it! You’re now debugging .NET Framework Source!

Debugging Form.cs in Windows Forms

Now, for each assembly that you’d like to debug into just repeat the steps above (note you’ll only see the EULA once, not for each file).

There are times when the Assembly you’d like to debug into isn’t on the call stack, for example in the code below:

image

Before you step in to Graphics.DrawRectangle, you need to get the symbols for System.Drawing.Dll loaded.  To do this, we use the Modules Window (CTRL+ALT+U).  This lists all of the modules (DLLs) loaded by the debuggee.  Just find System.Drawing.DLL in this list, right click, and choose Load Symbols.

Load via Modules Window

Note that once a symbol file is loaded, the path to the symbol file shows up in the "Symbol File" column.

You can now step into the Graphics.DrawRectangle code above using F11!  In this case, note, you’ll have to step through the PaintEventArgs.Graphics property code first.

ADVANCED USERS

Normally, each time you launch a debugging session, Visual Studio attempt to download symbols for each DLL that loads into the debuggee process.  As part of this process, it asks each path specified in the Debugging Symbols dialog for the corresponding PDB.  Some projects load a LOT of DLLs which won’t have symbols available, so this process can significantly impact debugger startup time as this probing occurs.  It is mainly for this reason we’ve recommended manual symbol loading in the steps above; we don’t want using this feature to degrade the debugging experience across-the-board.

There is, however, a way to allow automatic symbol loading (which avoids the "Load Symbols" step) in a way that minimizes performance impact.   This is for more advanced users because it requires regular trips back to this Debugging Symbols Dialog.  Note you can quickly get to this dialog by choosing the "Symbol Settings…" item on the right click menus pictured in steps above form the Call Stack or Modules windows.

The key is to get all of the symbols for a given project type downloaded and cached locally, then turn off the automatic symbol downloads.  This will prevent the pings at debugger startup as well.

To do this, configure your setup as above with the following difference: Uncheck the "Search from the above locations…" item on the dialog.

Now, launch your project in the debugger.  This will cause all of the symbols available for the DLLs in your process to be downloaded at on-demand as the DLLs are loaded into the process.  Depending on your connection speed, this could take a while (it’s generally about 50MB of symbols), so it’s a good idea to hit F5 then go do something else for a while.  Again, these symbols are cached so this is a one-time cost.  Visual Studio will likely be unresponsive during this download process.

image

Once that process has completed, stop the debugger, and UNCHECK the the Reference Source Server symbol location, and hit OK:

image

Now when you launch the debugger, symbols will load automatically and you’ll be be able to step in and through call stacks normally.  Note if you switch to a different project type (that has different assemblies), or have assemblies that are loaded later by your project, you can just repeat these steps to get any assemblies you don’t have cached locally). 

FAQ/TROUBLESHOOTING

1) Which assemblies are currently available for symbol/source loading:
  • Mscorlib.DLL
  • System.DLL
  • System.Data.DLL
  • System.Drawing.DLL
  • System.Web.DLL
  • System.Web.Extensions.DLL
  • System.Windows.Forms.DLL
  • System.XML.DLL
  • WPF (UIAutomation*.dll, System.Windows.DLL, System.Printing.DLL, System.Speech.DLL, WindowsBase.DLL, WindowsFormsIntegration.DLL, Presentation*.dll, some others)
  • Microsoft.VisualBasic.DLL
2) When I choose "Load Symbols" I get an Open File dialog asking for the PDB.

This can be caused by one of four situations:

  • You didn’t configure the symbol location URL properly from basic setup above.  Ensure it’s http://referencesource.microsoft.com/symbols.
  • You chose a cache symbols directory that your user account doesn’t have write permissions for.
  • You attempted to Load Symbols for a DLL that’s not available in the list above
  • You have a different version of the .NET Framework on your machine – this can happen, for example, if you’re running a Windows Server 2008 Beta.  To check this, go to the Modules Window in Visual Studio (CTRL+ALT+U) and ensure that the version number of your mscorlib.dll is 2.0.50727.1433, as below.  If not, make sure you install the RTM Version of the .NET Framework 3.5.

  • Check your "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE" (or wherever you installed VS) for a file called symsrv.no.  If that file exists, rename it to symsrv.yes, and restart Visual Studio. 
3) When I try to open or step into a source code file, I get a dialog that says "Source is not available for this location" or I get an Open File dialog for the file.

First, see FAQ item (2) above to ensure the symbols for the DLL were loaded successfully.  You can verify this by looking in the Modules Window under the "Symbols Status" column.

If the Symbols Status is "Symbols loaded.", check the following.

  • If you have configured Microsoft Symbol Server in the past, you may have already downloaded symbols for this DLL that don’t contain source information.  Try specifying a different cache path or deleting your existing cache path, and then repeating the Load Symbols command.   See FAQ #4 for more information on this.
  • Ensure you have checked the "Enable Source Server" item on the Tools -> Options -> Debugging -> General page
  • Ensure that your account has read/write access to your cache path
  • If you have _NT_SYMBOL_PATH set, it will override these settings.  Details here.
4) I also use Microsoft Symbol Server to download symbols.  What’s the difference? Can these two programs co-exist?

Microsoft Symbol Server provides symbols without any source information in them.  That information has been removed (sometimes referred to as "stripped") before publishing.  The symbols provided on the Reference Source Server are full symbols with debugging information.

The key to using both is to have your Reference Source path above the Symbol Server Path so that those symbols are searched/found first.  As described in the ADVANCED USERS section above, you’ll likely want to launch your debugger once with this configuration to get all the symbols downloaded, then uncheck both of these paths to avoid debugging launch slowdowns in the future.  Also note that this may conflict in the future as more DLLs are added to the Reference Source Project.  Meaning, if you’ve already downloaded the Symbol Server symbol, you’ll need to delete that or change your cache path to get the Reference Source one (Visual Studio has no way of knowing which is which).

image

One final note here, if you have the Microsoft Symbol Server configured via _NT_SYMBOL_PATH, you’ll need to add the Reference Source path above to that path as well – _NT_SYMBOL_PATH overrides the above settings.

5) Does this work with 64-bit?

Yes, we’ve also provided 64-bit versions of the PDBs.  Note some DLLs work on multiple architectures, so not all of them need a separate 64-bit PDB.

6) How do I set breakpoints in Framework code?

Visual Studio requires the code to exactly match what is expected by the PDB.  The source publishing process, however, makes some small updates to the code, such as pushing a standard copyright banner to the end of the source file.  This changes the signature (CRC) of the code file.  However, it’s still easy to set a breakpoint. 

Just set your breakpoint as normal (you’ll see it fails with a little warning icon), then right click the breakpoint and choose "Location…"

image

Then check the "Allow Source to be Different" box, hit OK.

image

Now the breakpoint will set successfully.

If you find yourself doing this often, you can also disable source matching in general by disabling Tools->Options->Debugging: “Require source files to exactly match the original version.”

7) Why don’t some features like "Go To Definition" work?

Browse database information is separate from symbol (PDB) information within the debugger, so that information is maintained by the project system when a project is compiled and is not present within the symbol files.  So, unfortunately, that ability is not available here.

8) Why are some member or local variables unavailable?  Why can’t I step into certain functions or lines of code?

The .NET Framework bits that you have installed on your machine are “retail” bits, which means they are optimized for size and performance.  Part of this optimization process removes certain information from the process when it is no longer needed.  Debugging retail assemblies reflects this.  However, most debugging information is still present in the session, and setting breakpoints earlier in a function often allows it to be visible.   Another aspect of retail builds is that some small methods may be “inlined” which means you will not be able to step into them or set breakpoints in them.  But for the most part you can step and debug as normal.

9) Why does it take so long to download some source files?

Some source files are very large – nearly 1MB – and unfortunately many of these are the common ones to download.  However, most are significantly smaller and download quickly.  Source files must be downloaded each time you restart Visual Studio.  They are not persistently cached like symbols are.

10) Can I just download all of the code at once?

Not currently, but we are currently working on enabling this functionality in the future.

11) When I debug into VB code, for example in Microsoft.VisualBasic.dll, there is a C# style comment at the bottom, is this a bug?

Not really – we do run a post processing step when publishing the code and it adds a standard copyright banner at the bottom.  The processor, at this time, isn’t able to support multiple comment formats.  Having it in a non-VB format doesn’t affect the debugging functionality in any way.

12) I got to a source file and all that downloaded was a blank file?

This is something we’ve seen intermittently but have not been able to diagnose.  If you see this, usually the workaround is to just restart VS, which will force the file to reload.  If you observe this behavior, please use the "Email" link on the left to email me the name of the file that failed and about what time the failure occurred.

13) What happens if I download a Hotfix or a Service Pack?  Will I be able to get source for that?

We’ve built a system that allows us to publish any number of versions of source and symbols for a given product.  We haven’t made any firm decisions on how often we’ll publish source and are open to customer feedback on those issues.  For example, it’s clear that publishing source for each Service Pack makes sense, but it’s unclear if we’ll be able to do so for each Hotfix.  Again, we’re looking forward to feedback here.

In the meantime, also note that symbol files may no longer match a module if a framework DLL has been updated via a Hotfix. In those cases, the modules window will indicate that the symbols could not be downloaded for that module. Assuming a new symbol file was published, it can be downloaded and cached using “Load Symbols”.

Published Wednesday, January 16, 2008 2:02 PM by sburke

Posted in Computers and Internet | Leave a comment

Problems in asp.net Sys.WebForms.PageRequestManagerParserErrorException error

I have copied this here from the following site:

http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid-it.aspx

 

Sys.WebForms.PageRequestManagerParserErrorException – what it is and how to avoid it

If you’ve used the Microsoft ASP.NET AJAX UpdatePanel control, there’s a good chance you’ve hit the "Sys.WebForms.PageRequestManagerParserErrorException" error.

What’s a PageRequestManagerParserErrorException?

The UpdatePanel control uses asynchronous postbacks to control which parts of the page get rendered. It does this using a whole bunch of JavaScript on the client and a whole bunch of C# on the server. Asynchronous postbacks are exactly the same as regular postbacks except for one important thing: the rendering. Asynchronous postbacks go through the same life cycles events as regular pages (this is a question I get asked often). Only at the render phase do things get different. We capture the rendering of only the UpdatePanels that we care about and send it down to the client using a special format. In addition, we send out some other pieces of information, such as the page title, hidden form values, the form action URL, and lists of scripts.

As I mentioned, this is rendered out using a special format that the JavaScript on the client can understand. If you mess with the format by rendering things outside of the render phase of the page, the format will be messed up. Perhaps the most common way to do this is to call Response.Write() during Page’s Load event, which is something that page developers often do for debugging purposes.

The client ends up receiving a blob of data that it can’t parse, so it gives up and shows you a PageRequestManagerParserErrorException. Here’s an example of what the message contains:---------------------------
Microsoft Internet Explorer
---------------------------
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.

Details: Error parsing near 'Hello, World!106|upd'.
---------------------------
OK  
---------------------------

If you ask me, this error message is not all that bad. After all, I’m the one that made it 🙂 The details indicate what was being parsed when it decided to give up. You can see the part of the text from my Response.Write(), and immediately after that is part of the special format I keep mentioning.

Why do I keeping getting a PageRequestManagerParserErrorException?

Well, chances are you’re doing one of the things mentioned in the error message. Here are the most common reasons and why they don’t work:

  1. Calls to Response.Write():
    By calling Response.Write() directly you are bypassing the normal rendering mechanism of ASP.NET controls. The bits you write are going straight out to the client without further processing (well, mostly…). This means that UpdatePanel can’t encode the data in its special format.
  2. Response filters:
    Similar to Response.Write(), response filters can change the rendering in such a way that the UpdatePanel won’t know.
  3. HttpModules:
    Again, the same deal as Response.Write() and response filters.
  4. Server trace is enabled:
    If I were going to implement trace again, I’d do it differently. Trace is effectively written out using Response.Write(), and as such messes up the special format that we use for UpdatePanel.
  5. Calls to Server.Transfer():
    Unfortunately, there’s no way to detect that Server.Transfer() was called. This means that UpdatePanel can’t do anything intelligent when someone calls Server.Transfer(). The response sent back to the client is the HTML markup from the page to which you transferred. Since its HTML and not the special format, it can’t be parsed, and you get the error.

How do I avoid getting a PageRequestManagerParserErrorException?

To start with, don’t do anything from the preceding list! Here’s a matching list of how to avoid a given error (when possible):

  1. Calls to Response.Write():
    Place an <asp:Label> or similar control on your page and set its Text property. The added benefit is that your pages will be valid HTML. When using Response.Write() you typically end up with pages that contain invalid markup.
  2. Response filters:
    The fix might just be to not use the filter. They’re not used very often anyway. If possible, filter things at the control level and not at the response level.
  3. HttpModules:
    Same as response filters.
  4. Server trace is enabled:
    Use some other form of tracing, such as writing to a log file, the Windows event log, or a custom mechanism.
  5. Calls to Server.Transfer():
    I’m not really sure why people use Server.Transfer() at all. Perhaps it’s a legacy thing from Classic ASP. I’d suggest using Response.Redirect() with query string parameters or cross-page posting.

Another way to avoid the parse error is to do a regular postback instead of an asynchronous postback. For example, if you have a button that absolutely must do a Server.Transfer(), make it do regular postbacks. There are a number of ways of doing this:

  1. The easiest is to simply place the button outside of any UpdatePanels. Unfortunately the layout of your page might not allow for this.
  2. Add a PostBackTrigger to your UpdatePanel that points at the button. This works great if the button is declared statically through markup on the page.
  3. Call ScriptManager.RegisterPostBackControl() and pass in the button in question. This is the best solution for controls that are added dynamically, such as those inside a repeating template.

Summary

I hope I’ve answered a lot of questions here and not angered too many of you. We’re looking at ways to improve some of these situations in the next version of ASP.NET, but of course there are no guarantees. If you avoid changing the response stream, you’re good to go. If you absolutely must change the response stream, simply don’t do asynchronous postbacks.

 

Published Monday, February 26, 2007 6:00 PM by Eilon

Filed under: , , ,
Posted in Computers and Internet | Leave a comment

Data Transformation Services

 I recently came upon a quandry of how to dynamicaly modify the precedence path of a Data Transformation project.  This was not as straight-forward as one would have thought.  Given the design project (see attached photo),  I created an ActiveX script module ‘Determine Path’ to perform this task.
 
I present to you, the code for that determination:
 
 
Function Main()
 Dim oPkg, oStep, oPrecedence
 Dim oFtpStep
 
‘ Setup access to this runtime Package properties
 Set oPkg = DTSGlobalVariables.Parent
‘ Gain access to the step in which data will be sent out to another device via FTP processing
 Set oFtpStep = oPkg.Steps("DTSStep_DTSActiveScriptTask_3")
‘ Now, gather up all information on that step for any precedence markers attached during
‘ the code design phase and remove all of those markers from this runtime.

 Set oPrecedence = oFtpStep.PrecedenceConstraints
 
 Do While oPrecedence.Count
  oPrecedence.Remove 1
 Loop
‘ Disable all steps in which the data is modified prior to going to the FTP step
 Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_1")
 oStep.DisableStep = True
 Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_2")
 oStep.DisableStep = True
 Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_3")
 oStep.DisableStep = True
 Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_4")
 oStep.DisableStep = True
 
‘ Which data processing step do we need to Enable given the user input?
 Select Case DTSGlobalVariables("FileToConvert").Value
  Case 1   
   Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_1")
   oStep.DisableStep = False
  
  Case 2
   Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_2")
   oStep.DisableStep = False
  Case 3
   Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_3")
   oStep.DisableStep = False
  Case 4
   Set oStep = oPkg.Steps("DTSStep_DTSDataPumpTask_4")
   oStep.DisableStep = False
 End Select
 
 
‘  Since we no know which step has been enabled, set the Precedence of the FTP step to this DataPump in 
‘  order to send the generated data out to the remote FTP site.
 Set oPrecedence = oFtpStep.PrecedenceConstraints.New(oStep.Name)
‘ Run the FTP step on a success of the data transformation pump.

 oPrecedence.PrecedenceBasis = DTSStepPrecedenceBasis_ExecResult
 oPrecedence.Value = DTSStepExecResult_Success
 oFtpStep.PrecedenceConstraints.Add oPrecedence
 
‘ House keeping
 Set oPkg = Nothing
 Set oStep = Nothing
 Set oPrecedence = Nothing
 
‘ Exit with a success.
 Main = DTSTaskExecResult_Success
End Function
This code module will select one of the 4 exit paths that are attached to this determination step.  It does this by disabling the step from first and then only enabling the datapump step for processing that has been selected by the user through a menu at startup.  It is also important to make sure that the proper precedence step is enabled that will feed the data to the FTP generator for transfering the appropriate data file as done through the oFTPSTep.PrecedenceConstraints.Add oPrecdence.
Posted in Computers and Internet | Leave a comment

That missing ACCESS library or module

Fix an ACCESS reference to a library

In many cases, Microsoft Access will fix missing references automatically when you open an Access file. Use the following procedure if you need to fix a missing reference manually.

  1. Open a module or create a new module.
  2. On the Tools menu, click References.
  3. In the Available References box, clear the check boxes next to any missing references, and select the check box next to the reference or references you want.

 

It always seems to be the Excel reference when porting from one system to the next.  Especially on an un-updated system.

 

Posted in Uncategorized | Leave a comment

ACCESS the woes of it all

I was given an interesting project not too long ago.  A project that is best suited for working in an TSQL environment, but it was to be created in ACCESS.  While the source tables come from MS SQL server, the various queries on the data are stored in an ACCESS project.  I needed to be able to send perameters to an ACCESS query and an SQL stored procedure (relatively the same approach).  Sounds straight forward yes?  Not exactilly, even the Access 2000 Developers Handbook Vol 1 and Vol 2 only hinted at the approach to take.  Finally in an obscure blog dated 1999, I found the solution…and I pass that on to anyone who enjoys reading blogs…
 
 
This is a simple example, in VBA, of how to gather, in this case a single return value, from an ACCESS query.  The key for all of this, lies in the use of the DAO object.  I hope that if anyone else is working in ACCESS and is creating an MSSQL / ACCESS query hybrid…while the documentation for accessing the SQL stored procedure is easy to find…this was a challange.  Really, the main problems come in decerning when to use the DAO or ADODB objects.
 
 
Private Function GetEffectDate(strEmployee As String, strPosition As String) as String
    Dim db As DAO.Database
    Dim qdf As QueryDef, rst As DAO.Recordset
   
        Set db = CurrentDb()     ‘ Tie into the Access Database engine…
        Set qdf = db.QueryDefs("qry_SelectEffectDate")      ‘ DBEngine(0)(0).QueryDefs("qry_SelectEffectDate")
         qdf.Parameters("employee") = Trim(strEmployee)   ‘ Now, set the parameters as defined in the query.
         qdf.Parameters("position") = Trim(strPosition)
        On Error Resume Next
       
        Set rst = qdf.OpenRecordset(dbOpenDynaset)       ‘ run the query with the variables
        If rst.RecordCount = 0 Then                                    ‘ view the result set
        GetEffectDate = Null
        Else
        GetEffectDate = rst("effect_date")                         ‘ get the value we queried for.
        End If
       
        rst.Close
        qdf.Close
        db.Close
       
        Set qdf = Nothing
        Set db = Nothing
        Set rst = Nothing
End Function
 
What does the  query look like?  qry_SelectEffectDate contains the following TSQL information.  From <Queries> <Design View> <SQL View>
 
PARAMETERS [employee] Short, [position] Text ( 255 );
SELECT TOP 1 First(RR.effect_date) AS effect_date
FROM dbo_rogerrabbit AS RR
WHERE (((RR.employee)=[employee]) AND ((RR.position)=[position]))
GROUP BY RR.effect_date
ORDER BY RR.effect_date DESC;
 
 
 
 
Posted in Computers and Internet | Leave a comment

Client Server project

I just received another exciting project!  This is from a client in china looking to control devices from a remote site.  The windows o/s will be unknown, as such, I will design in VB6 not in VB.NET.  I don’t want to be concerened with the amount of files that must be loaded to a PC in order to get the project to run.
 
After about 3 weeks of design time, the Client/Server interface is coming to a completion.  In this case, the client will application will run .mpg, .avi images and is adjustable to fit the location of the LED sign, tv, LCD media, or whatever media device has a pc control board connected to the video in.  The fun part in this project was tying into the ACCESS database for maintaining submitted scheduled jobs (typically, I have used the Microsoft SQL interface only).  For this case, I used VB6 Enterprise built in Data DEConnection..the import of Stored Procedures from the Access Interface is not very well done, as the Parameters do not show up properly in the calling VB code.  I found it much easier to create all stored procedures in the the VB6 data environment in order to setup the Paremeters that need to be passed to the Stored Procedures.
 
There are many applicable uses for this type of design, from monitoring traffic flow, to interfacing to any embedded device placed at remote locations for data exchange/monitor.
 
I am creating the same project in VB.NET.  The features available in VB.NET are indeed quite impressive.  It makes certain design creations second nature.  I could do the design in C#.NET, but I need to include the VB.NET modules to utilize the ‘ME’ feature.
Posted in Computers and Internet | Leave a comment

Some days

One of the nice things about working out of my home office is two-fold: 
– when I need a break, I can walk through my gardens and relax the mind
– just stand outside and enjoy the sunset.
– go from writing software to practicing acupuncture medicine
 
Looks like I will miss the big Oralando conference…Rats..  I am sure the Sarasota users group will have a lot to say on the subject.
 
I have been having some fun stepping back into the past with the vb6 stuff.  ADO handling and the Data environment. 
 
I found it difficult to use the data wizard as the default driver is set for Access ’97, and I am using the latest Access 2003.  So, the use of the Wizard was out of the question. But creating the Data Environment manual is not that difficult just make sure that you select the proper Microsoft Jet 4.0 and not the 3.5 engine.  From their, I found it much easier to create the database directly in Access 2003 environment.  Test the stored procedures and triggers prior to connecting the database to the vb6 data environment.
 
For calling a stored procedure that needs a variable to be passed, make sure your procedure looks like the following:
 
SELECT Client.ClientLogIn
FROM Client
WHERE Client.ClientLogIn=[@ClientLogIn] And Client.ClientPassword=[@ClientPassword];
Note the use of ‘@’ and not just a [?], vb6 tie in likes to have the variable name with an @predecessor.  Now for evoking the SP
 
In this case, the Data Environment has been named datClient.
 
 
Private Function ValidateUser(ByVal strLogIn As String, ByVal strPassword) As Boolean
    datClient.VerifyClientLogin strLogIn, strPassword
    If datClient.rsVerifyClientLogin.RecordCount = 0 Then        ‘ If a record is returned, we found the Client
        ValidateUser = False                                                         
    Else
        ValidateUser = True
    End If
    datClient.rsVerifyClientLogin.Close                                          ‘ Make sure to close this session.
End Function
 
Pretty easy to use don’t you think?  It is certainly much better then having to describe the connection just to gain access to the table.   Like the documentation states, for every query the data is returned with an ‘rs’ prefexed to the name of the query iself (this includes queries, and stored procedures).  (That particular point was not really clarified enough for me)
 
Until next time..
Posted in Computers and Internet | Leave a comment