Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘microsoft knowledge base article’

ASP.NET data binding overview

Symptoms
This article provides an introduction to ASP.NET data binding.
For additional ASP.NET overviews, see the following Microsoft Knowledge Base article:
305140?(http://support.microsoft.com/kb/305140/) ASP.NET roadmap
Resolution
With ASP.NET data binding, you can bind any server control to simple properties, collections, expressions and/or methods. When you use data binding, you have more flexibility when you use data from a database or other means.
This article addresses the following data binding topics: Data binding essentials<%# %> SyntaxPage.DataBind() versus Control.DataBind()Data-bound list controlsRepeater controlDataList controlDataGrid controlAccessing dataDataSet dlassDataReader dlassBinding in list control templatesDataBinder.Eval methodExplicit castingItemDataBound event
Data binding essentials<%# %> Syntax ASP.NET introduces a new declarative syntax, <%# %>. This syntax is the basis for using data binding in an .aspx page. All data binding expressions must be contained within these characters. The following list includes examples of simple data binding from multiple sources: Simple property (syntax for a customer):

<%# custID %> Collection (syntax for an order):

<asp:ListBox id=”List1″ datasource=’<%# myArray %>’ runat=”server”> Expression (syntax for a contact):

<%# ( customer.First Name + ” ” + customer.LastName ) %> Method result (syntax for the outstanding balance):

<%# GetBalance(custID) %> In the preceding examples, the inline <%# %> tags indicate where the information from a specific data source is to be placed in the .aspx page. The following data binding example uses a TextBox Web server control:

<asp:textbox id=txt text=”<%# custID %>” runat=server /> For more information about data binding syntax, see the following .NET Framework Software Development Kit (SDK) documentation:
Data Binding Expression Syntax
http://msdn2.microsoft.com/en-us/library/bda9bbfx(vs.71).aspx(http://msdn2.microsoft.com/en-us/library/bda9bbfx(vs.71).aspx)Page.DataBind() versus Control.DataBind() After the particular data sources have been determined and set for the objects on the .aspx page, you must bind the data to these data sources. You can use the Page.DataBind or the Control.DataBind method to bind the data to the data sources.
Both methods work similarly. The main difference is that all data sources are bound to their server controls after the Page.DataBind method is called. No data is rendered to the control until you explicitly call either the DataBind method of the Web server control or until you invoke the page-level Page.DataBind method. Typically, Page.DataBind (or DataBind) is called from the Page_Load event.
For more information about the DataBind method, see the following .NET Framework SDK documentation: Control.DataBind Method
http://msdn.microsoft.com/en-us/library/w5e5992d.aspx(http://msdn.microsoft.com/en-us/library/w5e5992d.aspx)
Data-bound list controls The list controls are special Web server controls that can bind to collections. You can use these controls to display rows of data in a customized template format. All list controls expose the DataSource and the DataMember properties, which are used to bind to collections.
These controls can bind their DataSource property to any collection that supports the IEnumerable, the ICollection, or the IListSource interface.
Repeater control The Repeater control is a templated, data-bound list. The Repeater control is “lookless;” that is, it does not have any built-in layout or styles. Therefore, you must explicitly declare all HTML layout, formatting, and style tags in the control’s templates.
The following code samples demonstrate how you can use one list control, the Repeater control, to display data:
NOTE: You must modify the parameters of the connection string as necessary for your environment.
Visual Basic .NET

<%@ Page Language=”vb” %><%@ Import Namespace=”System.Data” %><%@ Import Namespace=”System.Data.SqlClient” %><script runat=”server”>Sub Page_Load(sender As Object, e As EventArgs)Dim cnn As SqlConnection = New SqlConnection(“server=(local);” & _”database=pubs;Integrated Security=SSPI”)Dim cmd As SqlDataAdapter = New SqlDataAdapter(“select * from authors”, cnn)Dim ds As DataSet = New DataSet()cmd.Fill(ds)Repeater1.DataSource = dsRepeater1.DataBind()End Sub</script><html><body><form id=”Form1″ method=”post” runat=”server”><asp:Repeater id=”Repeater1″ runat=”server”><ItemTemplate><%# DataBinder.Eval(Container.DataItem,”au_id”) %><br> </ItemTemplate></asp:Repeater></form></body></html> Visual C# .NET

<%@ Page language=”c#” %><%@ Import Namespace=”System.Data” %><%@ Import Namespace=”System.Data.SqlClient” %><script runat=”server”>void Page_Load(Object sender, EventArgs e) {SqlConnection cnn = newSqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”);SqlDataAdapter da = new SqlDataAdapter(“select * from authors”, cnn);DataSet ds = new DataSet();da.Fill(ds, “authors”);Repeater1.DataSource = ds.Tables["authors"];Repeater1.DataBind();}</script><html><body><form id=”WebForm2″ method=”post” runat=”server”><asp:Repeater id=”Repeater1″ runat=”server”><ItemTemplate><%# DataBinder.Eval(Container.DataItem,”au_id”) %><br> </ItemTemplate></asp:Repeater></form></body></html> Visual J# .NET

<%@ Page language=”VJ#” %><%@ Import Namespace=”System.Data” %><%@ Import Namespace=”System.Data.SqlClient” %> <script runat=”server”>void Page_Load(Object sender, EventArgs e) {SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;IntegratedSecurity=SSPI”);SqlDataAdapter da = new SqlDataAdapter(“select * from authors”, cnn);DataSet ds = new DataSet();da.Fill(ds, “authors”);DataTableCollection dtc = ds.get_Tables();int index = dtc.IndexOf(“authors”);Repeater1.set_DataSource(dtc.get_Item(index));Repeater1.DataBind();}</script><html><body><form id=”WebForm2″ method=”post” runat=”server”><asp:Repeater id=”Repeater1″ runat=”server”><ItemTemplate><%# DataBinder.Eval(Container.DataItem,”au_id”) %><br></ItemTemplate></asp:Repeater></form></body></html> For more information about the Repeater control, see the following .NET Framework SDK documentation:
Repeater Web Server Control
http://msdn.microsoft.com/en-us/library/x8f2zez5.aspx(http://msdn.microsoft.com/en-us/library/x8f2zez5.aspx)DataList control The DataList class is a feature-rich, templated, data-bound list. You can modify the templates to customize this control. Unlike the Repeater control, DataList supports directional rendering and can optionally render in an HTML table at run time.
For more information about the DataList control, see the following .NET Framework SDK documentation:
DataList Web Server Control
http://msdn.microsoft.com/en-us/library/9cx2f3ks(VS.85).aspx(http://msdn.microsoft.com/en-us/library/9cx2f3ks(VS.85).aspx)DataGrid control The DataGrid control is a fully featured, multicolumn, data-bound grid. To customize the layout of individual columns in the DataGrid, you can set the column type to “templated” and modify the column’s templates. The DataGrid control can render without templates, which makes this control ideal for reporting scenarios. DataGrid also supports selection, editing, deletion, paging, and sorting by column and button columns.
For more information about the DataGrid control, see the following .NET Framework SDK documentation:
DataGrid Web Server Control
http://msdn.microsoft.com/en-us/library/aa710742(VS.71).aspx(http://msdn.microsoft.com/en-us/library/aa710742(VS.71).aspx)
Accessing data This section describes how to access data from a database and bind the data to list controls. You can use the DataSet or the DataReader class to obtain data from a database. DataSet class A DataSet contains a complete representation of data, including the table structure, the relationships between tables, and the ordering of the data. DataSet classes are flexible enough to store any kind of information from a database to an Extensible Markup Language (XML) file. DataSet classes are stateless; that is, you can pass these classes from client to server without tying up server connection resources. The following code demonstrates how to use a DataSet to bind data to a control:
NOTE: You must modify the parameters of the connection string as necessary for your environment.
Visual Basic .NET

Dim cnn As SqlConnection = New SqlConnection(“server=(local);” & _”database=pubs;Integrated Security=SSPI”)Dim cmd As SqlDataAdapter = New SqlDataAdapter(“select * from authors”, cnn)Dim ds As DataSet = New DataSet()cmd.Fill(ds)MyRepeater.DataSource = dsMyRepeater.DataBind() Visual C# .NET

SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”); SqlDataAdapter da = new SqlDataAdapter(“select * from authors”, cnn); DataSet ds = new DataSet(); da.Fill(ds);MyRepeater.DataSource = ds;MyRepeater.DataBind(); Visual J# .NET

SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”); SqlDataAdapter da = new SqlDataAdapter(“select * from authors”, cnn); DataSet ds = new DataSet(); da.Fill(ds); MyRepeater.set_DataSource(ds);MyRepeater.DataBind(); For more information about the DataSet class, see the following .NET Framework SDK documentation:
DataSet Class
http://msdn2.microsoft.com/en-us/library/system.data.dataset(vs.71).aspx(http://msdn2.microsoft.com/en-us/library/system.data.dataset(vs.71).aspx)DataReader class Conversely, if you only need to display (and not change) the data that is to be rendered, a DataReader class may be a better solution. For example, it is better to use a DataReader for a DropDownList control because the DataReader is a forward-only data cursor. The following code demonstrates how to use a SqlDataReader class to bind data to a control:
Visual Basic .NET

Dim cnn As SqlConnection = New SqlConnection(“server=(local);” & _”database=pubs;Integrated Security=SSPI”)Dim cmd As SqlCommand = New SqlCommand(“select * from authors”, cnn)cnn.Open()MyRepeater.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection)MyRepeater.DataBind() Visual C# .NET

SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”);SqlCommand cmd = new SqlCommand(“select * from authors”, cnn);cnn.Open();MyRepeater.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);MyRepeater.DataBind(); Visual J# .NET

SqlConnection cnn = new SqlConnection(“server=(local);database=pubs;Integrated Security=SSPI”); SqlCommand cmd = new SqlCommand(“select * from authors”, cnn); cnn.Open();MyRepeater.set_DataSource(cmd.ExecuteReader(CommandBehavior.CloseConnection));MyRepeater.DataBind(); For more information about the SqlDataReader class and data access with ASP.NET, see the following topics in the .NET Framework SDK documentation:
SqlDataReader Class
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx(http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx)
Developing High-Performance ASP.NET Applications
http://msdn2.microsoft.com/en-us/library/5dws599a(vs.71).aspx(http://msdn2.microsoft.com/en-us/library/5dws599a(vs.71).aspx)
Binding in list control templates You can use templates in the list controls to bind and to customize individual records of a data source. This section includes three methods to do this. DataBinder.Eval method When the data source works with data that is returned from a database, the data source may contain numerous pieces of information. You can use the generic DataBinder.Eval method to return data. In the following code sample, the “au_id” field is returned from the data source of the container object:

<%# DataBinder.Eval(Container.DataItem,”au_id”) %> For more information about the DataBinder.Eval method, see the following .NET Framework SDK documentation:
DataBinder.Eval Method
http://msdn.microsoft.com/en-us/library/4hx47hfe.aspx(http://msdn.microsoft.com/en-us/library/4hx47hfe.aspx)Explicit casting If you need more control, use explicit casting. An explicit conversion uses a type conversion keyword. These keywords act as functions, but the compiler generates the code inline. Therefore, execution is slightly faster than with a function call. The following code samples use explicit casting:
Visual Basic .NET

‘ DataTable as the DataSource<%# CType(Container.DataItem, System.Data.DataRowView)(“au_id”) %>’ DataReader as the DataSource<%# CType(Container.DataItem, System.Data.Common.DbDataRecord)(“au_id”) %>’ DataReader as the DataSource<%# CType(Container.DataItem, System.Data.Common.DbDataRecord)(0) %> Visual C# .NET

// DataTable as the DataSource<%# ((System.Data.DataRowView)Container.DataItem)["au_id"] %> // DataReader as the DataSource<%# ((System.Data.Common.DbDataRecord)Container.DataItem)["au_id"] %>// DataReader as the DataSource<%# ((System.Data.Common.DbDataRecord)Container.DataItem)[0] %> Visual J# .NET

// DataTable as the DataSource<%# ((System.Data.DataRowView)Container.DataItem)["au_id"] %> // DataReader as the DataSource<%# ((System.Data.Common.DbDataRecord)Container.DataItem)["au_id"] %>// DataReader as the DataSource<%# ((System.Data.Common.DbDataRecord)Container.DataItem)[0] %> Note that the preceding samples use either a DataTable, which is a subset of a DataSet, or DataReader as a data source. ItemDataBound event You can also use the ItemDataBound event of the control to bind the data. This event occurs when an item is data bound to the control. The following HTML code sample defines a Repeater control with an ItemTemplate:

<asp:repeater id=rptr runat=server><itemtemplate><asp:label id=lblAuthorID runat=server /></itemtemplate></asp:repeater> The following methods are required in your page:
Visual Basic .NET

public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)’TODO: Retrieve data from a database,’and bind the data to a list control.End Subpublic Sub rptr_OnItemDataBound(ByVal sender As Object, _ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptr.ItemDataBoundDim rec As DataRowViewrec = e.Item.DataItem’Make sure that you have the data.If Not IsDBNull(rec) ThenDim l1 As Labell1 = e.Item.FindControl(“lblAuthorID”)l1.Text = rec(“au_id”).ToString()End IfEnd Sub Visual C# .NET

public void Page_Init(object sender, System.EventArgs e){rptr.ItemDataBound += new RepeaterItemEventHandler(rptr_OnItemDataBound);}public void Page_Load(object sender, System.EventArgs e){// TODO: Retrieve data from a database,// and bind the data to a list control.}public void rptr_OnItemDataBound(object sender, RepeaterItemEventArgs e){System.Data.Common.DbDataRecord rec = (System.Data.Common.DbDataRecord)e.Item.DataItem;if(rec!=null) //Make sure that you have the data.{Label l1 = (Label)e.Item.FindControl(“lblAuthorID”);l1.Text = rec["au_id"].ToString();}} Visual J# .NET

public void Page_Init(Object sender, System.EventArgs e){rptr.add_ItemDataBound(new RepeaterItemEventHandler(rptr_OnItemDataBound));}private void Page_Load(Object sender, System.EventArgs e){// TODO: Retrieve data from a database,// and bind the data to a list control.}public void rptr_OnItemDataBound(Object sender, RepeaterItemEventArgs e){System.Data.Common.DbDataRecord rec = (System.Data.Common.DbDataRecord)e.get_Item().get_DataItem();if (rec != null) //Make sure that you have the data.{Label l1 = (Label)e.get_Item().FindControl(“lblAuthorID”);l1.set_Text(((rec.get_Item(“au_id”)).ToString()));}}

PRB: Jet 4.0 Row-Level Locking Is Not Available with DAO 3.60

Symptoms
According to Microsoft Knowledge Base article 275561?(http://support.microsoft.com/kb/275561/EN-US/) “ACC2000: New Features in Microsoft Jet 4.0″:
To minimize the impact of the increased page size and respond to a long-standing request from developers building applications based on the Microsoft Jet database engine, row-level locking was added to Jet 4.0.However, row-level locking of an Access database is not available with Data Access Objects (DAO) 3.60.
Resolution
To resolve this problem, use ActiveX Data Objects (ADO) to enable row-level locking on an Access database, and then open DAO connections to the database. All subsequent attempts to open DAO connections to the database will respect the locking mode that you set.

List of bugs fixed in Visual Studio 6.0 Service Pack 4

Symptoms
This article contains a list of Microsoft Knowledge Base article numbers for bugs that are fixed in Visual Studio version 6.0 Service Pack 4.
Service packs are cumulative. This means that the bugs fixed in a service pack are also fixed in subsequent service packs. Click the Qxxxxxx number that precedes the title of the article to view the article about that bug.
Visual Studio Service Pack 4 is available on from the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/vstudio/Aa718362.aspx(http://msdn2.microsoft.com/en-us/vstudio/Aa718362.aspx)
Resolution
Visual Basic
183979?(http://support.microsoft.com/kb/183979/) FIX: Visual Basic UserControls within UserControls do not print in Internet Explorer
224181?(http://support.microsoft.com/kb/224181/) FIX: GDI resource leak using checkboxes in ListView control
224185?(http://support.microsoft.com/kb/224185/) FIX: User defined type in public function of a user control fails to run
232194?(http://support.microsoft.com/kb/232194/) FIX: ITC OpenUrl method does not return complete files
234317?(http://support.microsoft.com/kb/234317/) FIX: HTML page truncated with Visual Studio SP3 WebClass run time when running in the VB IDE
234771?(http://support.microsoft.com/kb/234771/) FIX: Error 800a2328 returned when browsing a Visual Basic 6.0 WebClass (IIS application)
237175?(http://support.microsoft.com/kb/237175/EN-US/) FIX: VB IDE Improperly Changes Registry Entries of ATL Object Interface When Generating OCA File
238672?(http://support.microsoft.com/kb/238672/EN-US/) FIX: Mouse Hook Not Called When Used in User Controls
239943?(http://support.microsoft.com/kb/239943/EN-US/) FIX: UserControls with Menus Cause Resource Leak
240927?(http://support.microsoft.com/kb/240927/EN-US/) FIX: Cannot Read Source File Error Running PDW Distribution
245124?(http://support.microsoft.com/kb/245124/EN-US/) FIX: VB6SP4 – Access Violation in Remote Automation Manager (Autmgr32.exe)
245159?(http://support.microsoft.com/kb/245159/EN-US/) FIX: Winsock Control SendData Only Works Over the Latest Connection
246233?(http://support.microsoft.com/kb/246233/EN-US/) FIX: Selecting a Nested UserControl DataSource Property May Cause Crash
246919?(http://support.microsoft.com/kb/246919/EN-US/) FIX: Visual Basic Crashes on Code Generated by ActiveX Control Interface Wizard
248416?(http://support.microsoft.com/kb/248416/EN-US/) FIX: Wrong TreeView Node Selected When SingleSel Property = True
248418?(http://support.microsoft.com/kb/248418/EN-US/) FIX: Unable to Develop IIS Applications (WebClasses) on Windows 2000
249607?(http://support.microsoft.com/kb/249607/EN-US/) FIX: Visual Basic 6.0 UserControl in Excel Does Not Print or Display in Print Preview
253555?(http://support.microsoft.com/kb/253555/EN-US/) FIX: Error Message ‘Report Width Is Larger Than the Paper Width’ on Exporting Data Report
242483?(http://support.microsoft.com/kb/242483/EN-US/) FIX: Error 486 or 482 Occurs When Using PrintForm
254166?(http://support.microsoft.com/kb/254166/EN-US/) BUG: Distribution of Microsoft Scripting Runtime Library Fails
257421?(http://support.microsoft.com/kb/257421/EN-US/) FIX: Compiling ActiveX Project Does Not Release Reference Correctly
257495?(http://support.microsoft.com/kb/257495/EN-US/) FIX: ListView Executes the ItemClick Event Twice with LabelEdit Set to Manual
257496?(http://support.microsoft.com/kb/257496/EN-US/) FIX: Optimized Code Incorrectly Compares Floating Point Numbers
257501?(http://support.microsoft.com/kb/257501/EN-US/) FIX: Error Message When Exporting Data Report to HTML File
257516?(http://support.microsoft.com/kb/257516/EN-US/) FIX: Button Removed from Toolbar Cannot Be Added Back
257523?(http://support.microsoft.com/kb/257523/EN-US/) FIX: Resource Leak Occurs When You Display WMF Files in a PictureBox
257524?(http://support.microsoft.com/kb/257524/EN-US/) FIX: Adding Items to ListView Control Results in IPF on Win9x
257529?(http://support.microsoft.com/kb/257529/EN-US/) FIX: MonthView’s Year is Changed When Setting DayofWeek Property
257530?(http://support.microsoft.com/kb/257530/EN-US/) FIX: Images Replicated When Customizing a Toolbar
257531?(http://support.microsoft.com/kb/257531/EN-US/) FIX: Wrong Large Currency Values Returned from Late Bound Object
257543?(http://support.microsoft.com/kb/257543/EN-US/) FIX: MouseDown Event Fires Unexpectedly on Modal Form
257550?(http://support.microsoft.com/kb/257550/EN-US/) FIX: An Invalid Page Fault Error Occurs When You Use a DataReport
257572?(http://support.microsoft.com/kb/257572/EN-US/) FIX: Error Message ‘Missing Dependency Information’ for Mshtml.tlb When Using PDW
257630?(http://support.microsoft.com/kb/257630/EN-US/) FIX: Exception Error Closing an Application Containing a CoolBar Control
257635?(http://support.microsoft.com/kb/257635/EN-US/) FIX: DataGrid Loses Focus After You Cancel AddNew
257641?(http://support.microsoft.com/kb/257641/EN-US/) FIX: DataSource Drop-Down List Box Loads Slowly in Large Projects
257645?(http://support.microsoft.com/kb/257645/EN-US/) FIX: Setting Windowless Control to Transparent Prevents Animation
257657?(http://support.microsoft.com/kb/257657/EN-US/) FIX: Edit/Update Fails for SQL 7.0 for Column of Type Text When CursorDriver Is Set to rdUseODBC
257660?(http://support.microsoft.com/kb/257660/EN-US/) FIX: Setting Printer Object Reference to Nothing Causes IPF
257661?(http://support.microsoft.com/kb/257661/EN-US/) FIX: Double-Click Event of a Form May Fire the SSTab’s GotFocus and Click Events
257664?(http://support.microsoft.com/kb/257664/EN-US/) FIX: Object in a DLL on a Non-UI Thread Disables Modeless Forms in UI Thread
257686?(http://support.microsoft.com/kb/257686/EN-US/) FIX: Double-Clicking ListBox Control Causes Invalid Page Fault
257691?(http://support.microsoft.com/kb/257691/EN-US/) FIX: Dynamically Loaded UserControl Does Not Send Edits in Data-Bound Textboxes to Data Source
257692?(http://support.microsoft.com/kb/257692/EN-US/) FIX: Resource Leak if Control’s IMEMode Is Greater Than 0 (International Versions)
257695?(http://support.microsoft.com/kb/257695/EN-US/) FIX: Invalid Page Fault When Using Data Environment Designer
257703?(http://support.microsoft.com/kb/257703/EN-US/) FIX: ListView Control Still Active After Opening Modal Form
257707?(http://support.microsoft.com/kb/257707/EN-US/) FIX: Recordset Not Updated After Invoking the Move Method
257710?(http://support.microsoft.com/kb/257710/EN-US/) FIX: PointSelected of MSChart May Return Wrong DataPoint Value
257712?(http://support.microsoft.com/kb/257712/EN-US/) FIX: DBCS Characters Cause Duplicate Column Name When Using Jet 4
257714?(http://support.microsoft.com/kb/257714/EN-US/) FIX: ADO DataControl and DataEnvironment Events Only Work with ADO 2.0
257728?(http://support.microsoft.com/kb/257728/EN-US/) FIX: Client Winsock Control Never Connects to Server Control on Same Form
257730?(http://support.microsoft.com/kb/257730/EN-US/) FIX: PrintForm Method of a Form Containing a UserControl Causes IPF
257741?(http://support.microsoft.com/kb/257741/EN-US/) FIX: UserControl Validate Event Hangs the VB IDE
257777?(http://support.microsoft.com/kb/257777/EN-US/) FIX: Printer.Height May Eject the Wrong Amount of Paper with Some Dot Matrix Printers
257779?(http://support.microsoft.com/kb/257779/EN-US/) FIX: Printer Dialog of DataReport PrintReport Method Always Shows Portrait
257780?(http://support.microsoft.com/kb/257780/EN-US/) FIX: Unrecognized Database Format Error with Data Control or Data Form Wizard
257782?(http://support.microsoft.com/kb/257782/EN-US/) FIX: Visual Basic IDE Crashes Changing Control’s Name in Properties Window
257783?(http://support.microsoft.com/kb/257783/EN-US/) FIX: Function Returning Double Followed by Numeric Label Causes Crash
257784?(http://support.microsoft.com/kb/257784/EN-US/) FIX: ARROW Key Does Not Work on Cells that Contain Double-Byte Chars on Japanese Windows
257786?(http://support.microsoft.com/kb/257786/EN-US/) FIX: IPF in Msvbvm60.dll When Showing a Data Report After a Modal Form
257787?(http://support.microsoft.com/kb/257787/EN-US/) FIX: Program with UserControl Causes Access Violation When Exiting
257788?(http://support.microsoft.com/kb/257788/EN-US/) FIX: Navigating DataGrid Using Row Selector Fails to Submit Updates
257789?(http://support.microsoft.com/kb/257789/EN-US/) FIX: Data Source Is Not Updated When PropertyChanged Is Called
257792?(http://support.microsoft.com/kb/257792/EN-US/) FIX: TreeView NodeClick Events May Fire Despite Cancel = True
260098?(http://support.microsoft.com/kb/260098/EN-US/) FIX: Cannot Set the ComboBox Text in the Click Event in Visual Basic 6.0
257778?(http://support.microsoft.com/kb/257778/EN-US/) BUG: Closing Two MDI Child Forms Rapidly Results in an Invalid Page Fault
257732?(http://support.microsoft.com/kb/257732/EN-US/) BUG: VB6SP4 – GDI Resource Leak When UserControl’s MaskPicture Is Set to An Icon
257772?(http://support.microsoft.com/kb/257772/EN-US/) BUG: Updates to Textbox Bound to Remote Data Control Fail with rdUseClientBatch
257658?(http://support.microsoft.com/kb/257658/EN-US/) BUG: RDO BatchCollisionCount is Incorrect after BatchUpdate to SQL Server 7 Database
248837?(http://support.microsoft.com/kb/248837/EN-US/) Access Violation in VBA6.DLL During Compilation When Using SP3 Version of VBA6.DLL
Visual C++
167359?(http://support.microsoft.com/kb/167359/EN-US/) FIX: extern Declaration Generates Extra Constructor Call
231655?(http://support.microsoft.com/kb/231655/EN-US/) FIX: VC++ Stops Responding Opening Files or Adding Files to Projects
231872?(http://support.microsoft.com/kb/231872/EN-US/) FIX: Using #import May Cause Memory Leaks
234511?(http://support.microsoft.com/kb/234511/EN-US/) FIX: BUG: Visual C++ 6.0 Compiler Does Not Remove Some Unneeded Instruction
234602?(http://support.microsoft.com/kb/234602/EN-US/) FIX: /Og Generates Bad Code for a Compare/Branch
235434?(http://support.microsoft.com/kb/235434/EN-US/) FIX: ‘Attach to Process’ List Is Empty
243599?(http://support.microsoft.com/kb/243599/EN-US/) FIX: VC Debugger Fails on Some Long Names
248477?(http://support.microsoft.com/kb/248477/EN-US/) FIX: Deadlock Using STL Map or Set In Multithreaded Application
251362?(http://support.microsoft.com/kb/251362/EN-US/) FIX: Suspend and Resume Thread Hangs Visual C++ Debugger
229889?(http://support.microsoft.com/kb/229889/EN-US/) QuickView Command Is Missing from Windows 2000
256056?(http://support.microsoft.com/kb/256056/EN-US/) FIX: DllMain Throws Unhandled Exception with DLL_THREAD_DETACH
256158?(http://support.microsoft.com/kb/256158/EN-US/) FIX: Text May Appear Truncated in MFC Applications Localized for Japanese Windows 2000
256329?(http://support.microsoft.com/kb/256329/EN-US/) FIX: Opening a CFileDialog from Handler of a Custom CFileDialog Causes Access Violation
259723?(http://support.microsoft.com/kb/259723/EN-US/) FIX: Debugger Fails on Fast Dual Processors
259726?(http://support.microsoft.com/kb/259726/EN-US/) FIX: Debugger Encounters Invisible Breakpoints in Assembly Code
259746?(http://support.microsoft.com/kb/259746/EN-US/) FIX: C1001 Compiler Error When Virtual Function Used as a Parameter
260172?(http://support.microsoft.com/kb/260172/EN-US/) FIX: MFC ISAPI Parse Functions Fail Under Stress on Multiple-CPU Computers
262515?(http://support.microsoft.com/kb/262515/EN-US/) FIX: /GT Compiler Switch May Cause Access Violation (AV) During Thread Switches
262698?(http://support.microsoft.com/kb/262698/EN-US/) FIX: Visual C++ 6.0 Debugger Stops Responding on Multiprocessor Computers
201641?(http://support.microsoft.com/kb/201641/EN-US/) FIX: Euro Symbol in ODL/IDL File Causes Visual C++ IDE to Stop Responding
Visual FoxPro
217174?(http://support.microsoft.com/kb/217174/EN-US/) FIX: APPEND FROM TYPE XL8 Makes VFP 6 Disappear
221745?(http://support.microsoft.com/kb/221745/EN-US/) FIX: C0000005 Fatal Error Using GETPEM() in Loop with Debugger
238945?(http://support.microsoft.com/kb/238945/EN-US/) FIX: Repeatedly Manipulating Data in Editbox Causes Error Message
250059?(http://support.microsoft.com/kb/250059/EN-US/)FIX: Accessing Printer Drivers After Issuing SYS(1037) Might Cause Error
258428?(http://support.microsoft.com/kb/258428/EN-US/) FIX: Printer Name Longer than 64 Characters Causes Error
258530?(http://support.microsoft.com/kb/258530/EN-US/) FIX: Multiple References to File Object of Project Causes OLE Error
258532?(http://support.microsoft.com/kb/258532/EN-US/) FIX: Random Characters in Report Do Not Print Under Localized Windows
258533?(http://support.microsoft.com/kb/258533/EN-US/) FIX: Cannot Resize Grid Column Widths Under Localized Windows
258536?(http://support.microsoft.com/kb/258536/EN-US/) FIX: UP ARROW Key Not Working in Code Editor Under Hebrew Windows
258537?(http://support.microsoft.com/kb/258537/EN-US/) FIX: Config.fpw Setting for Terminal Server Environment
258736?(http://support.microsoft.com/kb/258736/EN-US/) FIX: Multi-Threaded DLL Is Slow to Release Connection Under MTS
258737?(http://support.microsoft.com/kb/258737/EN-US/) FIX: DataSession Property Cannot Be Set in Session Subclass
262789?(http://support.microsoft.com/kb/262789/EN-US/) INFO: New SYS(2800) Function Improves Magnifier Accessibility Tool
262878?(http://support.microsoft.com/kb/262878/EN-US/) FIX: Fatal Exception with Large Number of Variables or Objects
Visual InterDev
259485?(http://support.microsoft.com/kb/259485/EN-US/) FIX: Devenv.exe Application Error (0×67bbfbdf) Occurs When You Are Using Visual InterDev 6.0
243809?(http://support.microsoft.com/kb/243809/EN-US/) BUG: Recordset DTC Does Not Recognize Data Connection; Connection Information Appears in Red
261150?(http://support.microsoft.com/kb/261150/EN-US/) FIX: Visual InterDev Incorrectly Determines Web Server Version
261152?(http://support.microsoft.com/kb/261152/EN-US/) FIX: Visual InterDev Returns Generic ‘Unable to Contact Web Server’ Error
261153?(http://support.microsoft.com/kb/261153/EN-US/) INFO: Can’t Create/Modify SQL Server 2000 Table, View, Diagram
262601?(http://support.microsoft.com/kb/262601/EN-US/) FIX: Menu Does Not Appear When You Right-Click in the Query Builder
Visual SourceSafe
230702?(http://support.microsoft.com/kb/230702/EN-US/) FIX: Errors When Renaming or Deleting a Project in Visual SourceSafe
236810?(http://support.microsoft.com/kb/236810/EN-US/) FIX: Command Line GET Fails with ‘Unable to finish writing file’ Error
237184?(http://support.microsoft.com/kb/237184/EN-US/) FIX: Branching from Label Causes Error ‘You do not have access rights to $/’
244960?(http://support.microsoft.com/kb/244960/EN-US/) FIX: Analyze and DDUPD Return ‘Out of Memory’
244961?(http://support.microsoft.com/kb/244961/EN-US/) FIX: Analyze.exe -f Replaces Project Data Files with a 0 Byte File
248760?(http://support.microsoft.com/kb/248760/EN-US/) FIX: Project Log ‘Physical Filename’ has a Share (From Another Project)
259902?(http://support.microsoft.com/kb/259902/EN-US/) FIX: Installation of Service Pack 4 Does Not Update Readmess.htm with Latest Version
259915?(http://support.microsoft.com/kb/259915/EN-US/) FIX: Analyze.exe Corrupts MBCS File Names When First 8 Bytes Are Same Text
Visual Studio
260049?(http://support.microsoft.com/kb/260049/EN-US/) FIX: Database Problems with Nulls and Data Type Precision
260092?(http://support.microsoft.com/kb/260092/EN-US/) FIX: If You Create a Table With Query Analyzer from Visual InterDev then the SQL Enterprise Manager Inserts the Incorrect Decimal (9, 0) Values
260095?(http://support.microsoft.com/kb/260095/EN-US/) FIX: Table Created in Visual Studio Is Not Owned by the DBO Who Created It
260128?(http://support.microsoft.com/kb/260128/EN-US/) FIX: SP4 JPN: Several Files are in English Instead of Japanese
250334?(http://support.microsoft.com/kb/250334/EN-US/) PRB: MSDN Library Unable to Display Help from Within Visual Studio Programs
260030?(http://support.microsoft.com/kb/260030/EN-US/) FIX: Visual Studio Service Pack 3 Does Not Update Hhcrtl.ocx and Itss.dll
260032?(http://support.microsoft.com/kb/260032/EN-US/) FIX: Incorrect Versions of VFP6.exe and VB6.exe in Visual Studio 6
260051?(http://support.microsoft.com/kb/260051/EN-US/) FIX: Compatibility Problems with the Redistribution Files in the Oleaut32.dll File
260085?(http://support.microsoft.com/kb/260085/EN-US/) DOC: The Japanese Translated Version of Visual Studio Service Pack 3 Readme Contains Errors
260086?(http://support.microsoft.com/kb/260086/EN-US/) FIX: DataTools: Resource ID #1634 ‘Where’ Is Mistakenly Translated into Japanese
260094?(http://support.microsoft.com/kb/260094/EN-US/) FIX: The Schema Designer Does Not Support the Precision of DECIMAL and NUMERIC Data-Types that are More than 29 Places
260104?(http://support.microsoft.com/kb/260104/EN-US/) The Willamette Processor Name Has Changed
260140?(http://support.microsoft.com/kb/260140/EN-US/) FIX: The Msdis110.dll File Is Not Updated by the Installation of Windows NT 4 Service Pack 4
262768?(http://support.microsoft.com/kb/262768/EN-US/) FIX: SQL Enterprise Manager Causes Access Violations When You Resize the Grid in the Design View
262909?(http://support.microsoft.com/kb/262909/EN-US/) FIX: FIX: Query Design Table Is Cut Off in Korean Windows 2000

INFO: Visual Basic Accessing an Oracle Database Using ADO

Symptoms
With Visual Basic and ADO, you have the ability to connect to anOracle database through a DSN-Less connection, execute a stored procedureusing parameters, and get return values from that stored procedure. Theexample in this article illustrates all of this functionality.
Resolution
To run the sample code in this article, you may need to download andinstall the Microsoft Data Access Components if you are using Visual Basic 5.0. The MDAC Components are located at:http://msdn.microsoft.com/en-us/data/aa937729.aspx(http://msdn.microsoft.com/en-us/data/aa937729.aspx)The following example was created against an Oracle 7.3 database through aSQL*Net 2.3 connection. All of the following code (including the storedprocedure) should work fine with Oracle 7.2. However, the Microsoft ODBCDriver for Oracle Help file states that it only supports SQL*Net 2.3.
There are two objects that need to be created on the Oracle database; atable (adooracle) and a stored procedure (adoinsert).
NOTE: If you have worked through the following Microsoft Knowledge Base article then you can use the Oracle objects created in that article (rdooracle and rdoinsert). Just change the Visual Basic code below accordingly:

167225?(http://support.microsoft.com/kb/167225/EN-US/) HOWTO: Access an Oracle Database Using RDO
Here are the data definition language (DDL) scripts to create theseobjects:
ADOORACLE – This is just a two-column table with the first column set asthe primary key:

CREATE TABLE adooracle (item_numberNUMBER(3) PRIMARY KEY,depot_numberNUMBER(3));
ADOINSERT – This procedure accepts a single numeric input parameter andreturns a single numeric output parameter. The input parameter is firstused by an input statement, then it is divided by 2 and set as the outputparameter:

CREATE OR REPLACE PROCEDURE adoinsert (insnum IN NUMBER, outnum OUT NUMBER)ISBEGININSERT INTO adooracle(Item_Number, Depot_Number)VALUES(insnum, 16);outnum := insnum/2;END;/
In SQL 3.3, use a foward slash (/) to terminate and execute the script declaring the stored procedure.
NOTE: You must use Procedures that have output parameters and not Functions when working with Oracle and ADO parameters.
The preceding scripts can be run from SQL*Plus. Once these objects have been created, you can create the Visual Basic project that will use them.
This sample project uses a simple form to send a bind parameter to theADOINSERT stored procedure and then return the output parameter from thatprocedure. Here are the steps to create the project:
Open a new project in Visual Basic and add a Reference to the Microsoft ActiveX Data Objects library.Place the following controls on the form:

ControlNameText/CaptionButtoncmdCheckCheckButtoncmdSendSendText BoxtxtInputLabellblInputInput: From the Tools menu, choose Options, Click the “Default FullModule View” option, and then click OK. This allows you to view allof the code for this project.Paste the following code into your code window:

Option ExplicitDim Cn As ADODB.ConnectionDim CPw1 As ADODB.CommandDim CPw2 As ADODB.CommandDim Rs As ADODB.RecordsetDim Conn As StringDim QSQL As StringPrivate Sub cmdCheck_Click()CPw1(0) = Val(txtInput.Text)Set Rs = CPw1.ExecuteMsgBox “Item_Number = ” & Rs(0) & “.Depot_Number = ” & Rs(1) & “.”Rs.CloseEnd SubPrivate Sub cmdSend_Click()CPw2(0) = Val(txtInput.Text)CPw2.ExecuteMsgBox “Return value from stored procedure is ” & CPw2(1) & “.”End SubPrivate Sub Form_Load()’You will need to replace the “*” with the appropriate values.Conn = “UID=*****;PWD=****;DRIVER={Microsoft ODBC for Oracle};” _& “SERVER=*****;”Set Cn = New ADODB.ConnectionWith Cn.ConnectionString = Conn.CursorLocation = adUseClient.OpenEnd WithQSQL = “Select Item_Number, Depot_Number From adooracle Where ” _& “item_number = ?”Set CPw1 = New ADODB.CommandWith CPw1.ActiveConnection = Cn.CommandText = QSQL.CommandType = adCmdText.Parameters.Append .CreateParameter(, adInteger, adParamInput)End WithQSQL = “adoinsert”Set CPw2 = New ADODB.CommandWith CPw2.ActiveConnection = Cn.CommandText = QSQL.CommandType = adCmdStoredProc.Parameters.Append .CreateParameter(, adInteger, adParamInput).Parameters.Append .CreateParameter(, adDouble, adParamOutput)End WithEnd SubPrivate Sub Form_Unload(Cancel As Integer)Cn.CloseSet Cn = NothingSet CPw1 = NothingSet CPw2 = NothingEnd Sub Run the project.When you enter a number in the text box, txtInput, and click the Send button, the Oracle stored procedure, ADOINSERT, is called. The number you entered in the text box is used as the input parameter for the procedure. The output parameter is used in a message box that is called after the stored procedure has completed processing. With your original value still in the text box, click the “Check” button. This creates a simple read-only resultset that is displayed in another message box.
What follows is a detailed explanation of the code used in thisdemonstration project.
The Form_Load event contains the code that creates the DSN-Less connection:

Conn = “UID=<uid>;PWD=<pwd>;DRIVER={Microsoft ODBC for Oracle};” _& “SERVER=<MyServer>;”Set Cn = New ADODB.ConnectionWith Cn.ConnectionString = Conn.CursorLocation = adUseClient.OpenEnd With Once you create the ADO connection object (Cn), you set several of itsparameters using the WITH statement.
The connect string that is used to open a connection to an Oracle database(or any database for that matter) is very dependant on the underlying ODBCdriver. You can see in the connect string below that the Microsoft Oracledriver you are using is named specifically by DRIVER=:

Conn = “UID=<uid>;PWD=<pwd>;DRIVER={Microsoft ODBC for Oracle};” _& “SERVER==<MyServer>;” The most important part of this connect string is the “SERVER” keyword. Thestring assigned to SERVER is the Database Alias which you set up inSQL*Net. This is the only difference in the connect string when connectingto an Oracle database. For a DSN-Less connection, as is stated in the Helpfile, you do not specify a DSN in the connect string.
Also in the Form_Load event is the code that creates the two ADO Commandobjects used in the project:

QSQL = “Select Item_Number, Depot_Number From adooracle Where ” _& “item_number = ?”Set CPw1 = New ADODB.CommandWith CPw1.ActiveConnection = Cn.CommandText = QSQL.CommandType = adCmdText.Parameters.Append .CreateParameter(, adInteger, adParamInput)End WithQSQL = “adoinsert”Set CPw2 = New ADODB.CommandWith CPw2.ActiveConnection = Cn.CommandText = QSQL.CommandType = adCmdStoredProc.Parameters.Append .CreateParameter(, adInteger, adParamInput).Parameters.Append .CreateParameter(, adDouble, adParamOutput)End With The first Command object (CPw1) is a simple parameterized query. TheCommandText has one parameter that is the item_number for the where clause.Note that the CommandType is set to adCmdText. This is different than theadCmdStoredProc CommandType in the second Command object (CPw2). The following is from the ADO Help HTML file:
“Use the CommandType property to optimize evaluation of the CommandTextproperty. If the CommandType property value equals adCmdUnknown (thedefault value), you may experience diminished performance because ADO mustmake calls to the provider to determine if the CommandText property is anSQL statement, a stored procedure, or a table name. If you know what typeof command you’re using, setting the CommandType property instructs ADO togo directly to the relevant code. If the CommandType property does notmatch the type of command in the CommandText property, an error occurs whenyou call the Execute method.”Using the WITH command, you can create and append parameters to the commandobject easily. The first parameter of the CreateParameter function is forthe name of the parameter. This has been left blank because the sampleprogram uses the index of the parameters collection to identify theindividual parameters (such as CPw1(0) to identify the first parameter).The sample program uses adInteger and adDouble datatypes. If it had used avariable length datatype, then the size parameter of the CreateParameterfunction would need to be set. Again, from the ADO Help HTML:
“If you specify a variable-length data type in the Type argument, you musteither pass a Size argument or set the Size property of the Parameterobject before appending it to the Parameters collection; otherwise, anerror occurs.”The remainder of the project is fairly straightforward and well-documentedin both the Online Help file and Books Online which come with Visual Basic.The ADO issues that are critical to working with Oracle (the connectstring and the calling of stored procedures) have been detailed in thisproject.

How To Implement Nested Transactions with Oracle

Symptoms
ADO and ODBC do not support nested transactions. However, native Oracle SQLsupports the SAVEPOINT keyword that can be used to simulate nestedtransactions.
Resolution
The Microsoft Knowledge Base article 177138?(http://support.microsoft.com/kb/177138/EN-US/), entitled “INFO: NestedTransactions Not Available in ODBC/OLE DB/ADO” says this about nestedtransactions:
“Neither Open Database Connectivity (ODBC, nor any released MicrosoftOLE DB Provider supports Nested Transactions. ActiveX Data Objects (ADO)supports the feature, but only if the underlying provider exposes it.Currently none of Microsoft’s OLE DB providers support NestedTransactions.”
This is true for the Microsoft ODBC for Oracle driver. However, by usingthe SAVEPOINT keyword, you can simulate Nested Transactions. For moreinformation about native ODBC or ADO support for Nested Transactions,please see the article mentioned above.
The SAVEPOINT keyword basically sets a bookmark for uncommitted statementsin an Oracle session. You can rollback these statements by using the TOoption with the ROLLBACK statement. This all has to be done through Executestatements (such as in the form of <connection>.Execute) because the ODBCparser cannot parse the SAVEPOINT keyword properly.
The following code shows how this all works:

Conn = “UID=****;PWD=****;DRIVER={Microsoft ODBC for Oracle};” _& “SERVER=SamOracle;”Set Cn = New ADODB.ConnectionWith Cn.ConnectionString = Conn.CursorLocation = adUseClient.OpenEnd WithCn.BeginTransCn.Execute “SAVEPOINT ALPHA”Cn.Execute “INSERT INTO trantest VALUES(1,10)”Cn.Execute “INSERT INTO trantest VALUES(2,10)”Cn.Execute “SAVEPOINT BETA”Cn.Execute “INSERT INTO trantest VALUES(3,10)”Cn.Execute “INSERT INTO trantest VALUES(4,10)”Cn.Execute “ROLLBACK TO SAVEPOINT BETA”Cn.Execute “COMMIT”Cn.RollbackTrans NOTE: This assumes a table “Trantest” exists on the Oracle server.
This code will commit the first two INSERT statements and rollback thesecond two. You will notice that the whole set of statements is surroundedwith a CONNECTION level BeginTrans and CommitTrans. This is necessary sothat, at the ODBC API level, the SQLSetConnectOption SQL_AUTOCOMMIT is setto SQL_AUTOCOMMIT_OFF. After you have finished your transaction it is agood idea to re-set SQL_AUTOCOMMIT to SQL_AUTOCOMMIT_ON (the default) byexecuting either a CommitTrans or a RollbackTrans. Because you have eithercommitted or rolled backed your transactions with your Execute statements,it doesn’t matter whether you call CommitTrans or RollbackTrans; eitherway, they have nothing to commit or rollback. You are just calling thesefunctions to reset SQL_AUTOCOMMIT to SQL_AUTOCOMMIT_ON, which they both do.