Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning
Can anyone explain how it is hapenning Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Go Back  Xtreme Visual Basic Talk > > > Can anyone explain how it is hapenning


Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2003, 11:48 PM
king_salman king_salman is offline
Newcomer
 
Join Date: Nov 2003
Location: PAKISTAN
Posts: 7
Default Can anyone explain how it is hapenning


hi,
This is the weirdest of things that is hapening.
this uses a access database.the table in database is Citycodes with two columns
Citycode datatype=text,length=7
CityName datatype=text,length=48
i have a oledb dataset named ds,oledb dataadapter ada.ds has six tables
PtclNumbers
MobileNumbers
InternationalNumbers
PtclCityCodes
Country
MobileCompanyCode
now the tables have same name,caption and variable name used in form
i.e
me.MobileCompanyCode
MobileCompanyCode.caption="MobileCompanyCode"
MobileCompanyCode.name="MobileCompanyCode"
In ptclcitycodes table there are two columns
PtclCityCode
PtclCityName
column mapping is element and it is same for all tables.now my application is an mdi application so this ds, and ada are declared in parent form.
Parent forms class is
Public Class MainScreen
In each child form i have declared an private variable myParent.this myparent is of type ptcldatabase.MainScreen where ptcldatabase is my application name space.in one child form that is addNatinalPersonal i have a public function fillcontrol.the pourpouse of fill control is to fill a combobox with city code,and city name
complete code of fill control is given below
Code:
Public Function FillControl() Dim RowCount As Int16 = 0 Me.Cursor.Current = Cursors.WaitCursor MyParent = Me.MdiParent With MyParent Dim commandbiulder As New OleDb.OleDbCommandBuilder(.Ada) Try '.Ds.Tables.Clear() .Ada.SelectCommand = New OleDb.OleDbCommand() '.Ds.Tables("PtclNumbers").Rows.Clear() 'MsgBox(.Ds.Tables("PtclCityCodes").Columns(0).ColumnName.ToString, MsgBoxStyle.OKOnly) 'MsgBox(.Ds.Tables("PtclCityCodes").Columns(1).ColumnName.ToString, MsgBoxStyle.OKOnly) ' MsgBox(.Ds.Tables("PtclCityCodes").Columns(2).ColumnName.ToString, MsgBoxStyle.OKOnly) 'MsgBox(.Ds.Tables("PtclCityCodes").Columns(3).ColumnName.ToString, MsgBoxStyle.OKOnly) .Ada.SelectCommand.Connection = .Con .Ada.SelectCommand.CommandType = CommandType.Text '.Ada.SelectCommand.CommandText = "Select CityCodes.Citycode,CityCodes.CityName From CityCodes Order By CityCodes.CityName" .Ada.SelectCommand.CommandText = "Select * From CityCodes " .Con.Open() ' MsgBox(.Ds.Tables("PtclCityCodes").Rows.Count.ToString, MsgBoxStyle.OKOnly) .Ada.Fill(.Ds, "PtclCityCodes") ' MsgBox((.Ds.Tables("PtclCityCodes").Columns.Count.ToString), MsgBoxStyle.OKOnly) Try For RowCount = 0 To .Ds.Tables("PtclCityCodes").Rows.Count - 1 Me.CmbCityCodeName.Items.Add((.Ds.Tables("PtclCityCodes").Rows(RowCount).Item(1).ToString) & " " & (.Ds.Tables("PtclCityCodes").Rows(RowCount).Item(0).ToString)) Next ' For RowCount = 0 To .Ds.Tables("PtclCityCodes").Columns.Count - 1 'Me.CmbCityCodeName.Items.Add((.Ds.Tables("ptclcitycodes").Columns(RowCount).ColumnName.ToString)) 'Next RowCount Catch eselectexception As Exception MsgBox(eselectexception.ToString, MsgBoxStyle.Critical, "Fill Error") End Try Catch eselectexception As Exception MsgBox(eselectexception.ToString, MsgBoxStyle.Critical, "Fill Error") Finally .Con.Close() End Try End With Me.Cursor.Current = Cursors.Default End Function

Now what happens is that when fill control is called it creates two new columns in ptclcitycodes whose names are CityCode,Cityname which means the table looks like this
Table PtclCityCodes
Column PtclCityCode
Column PtclCityName
Column CityCode
Column CityName
the same columns which are present in database table and all the records returned have been stored in these two columns now i am not creating any new columns in dataset's table neither i have used the addrange so how it is that these columns are created.i have checked all the code of application in other forms.can any one help.One thing more i have used the same algorithm in 2 other forms and it worked why it is troubling here i seriously do not know.
if you notice the message boxes i used them to try and find the cause.the language as you migth have noticed is vb.net
and frame work is 1.0.

Last edited by king_salman; 12-18-2003 at 02:08 AM. Reason: Added vb tags and indention
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone explain dates to me? JasonWiest General 5 10-16-2003 06:34 PM
Can anyone explain this? (SQL Server Dates) Granty Database and Reporting 1 01-29-2003 09:41 AM
How would you explain VB?? snowy Tech Discussions 7 11-24-2002 10:34 PM
How would you explain VC++?? snowy Miscellaneous Languages 4 11-24-2002 08:28 PM
could someone explain... Insomnia Database and Reporting 2 10-17-2002 08:31 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
 
Can anyone explain how it is hapenning
Can anyone explain how it is hapenning
 
-->