How do I tell DataAdapter that Column 2 and 3 are string and not integer?
Following is the example data that comes from the .csv file
FEDERAL TAX,1084,0000
COREHCR,1084,00 00
CLIENT P,1084,0000
The select is:
Dim da2 As New OleDb.OleDbData Adapter("Select * from " &
"CorelandGLConv ersion.csv", conn)
The problem is that it thinks the 3rd column is an integer and changes the
0000 to 0.
Can I tell it in the Select statement that the column is a varChar? I can't
do it after reading in the data as the data will already have changed the
0000 to 0 at that point.
Thanks,
Tom. 4 1664
"tshad" <t@home.comwrot e in message
news:u5******** *****@TK2MSFTNG P05.phx.gbl...
How do I tell DataAdapter that Column 2 and 3 are string and not integer?
Following is the example data that comes from the .csv file
FEDERAL TAX,1084,0000
COREHCR,1084,00 00
CLIENT P,1084,0000
The select is:
Dim da2 As New OleDb.OleDbData Adapter("Select * from " &
"CorelandGLConv ersion.csv", conn)
The problem is that it thinks the 3rd column is an integer and changes the
0000 to 0.
Can I tell it in the Select statement that the column is a varChar? I
can't do it after reading in the data as the data will already have
changed the 0000 to 0 at that point.
I tried to set up the table as:
Dim DTGLConversion as DataTable
DTGLConversion. Columns.Add("F1 ", System.Type.Get Type("System.St ring"))
DTGLConversion. Columns.Add("F2 ", System.Type.Get Type("System.St ring"))
DTGLConversion. Columns.Add("F3 ", System.Type.Get Type("System.St ring"))
da2.Fill(DTGLCo nversion)
DataSetObj.Tabl es.Add(DTGLConv ersion)
This sets up the columns as strings in the DTGLConversion Table and adds it
to the Dataset but it seems the Select in the DataAdapter must have already
converted the string "0000" to integer 0 and then when I filled the
DataTable it reconverted it to "0".
How do I fix this?
Thanks,
Tom
On Mar 28, 5:11 am, "tshad" <t...@home.comw rote:
"tshad" <t...@home.comw rote in message
news:u5******** *****@TK2MSFTNG P05.phx.gbl...
How do I tell DataAdapter that Column 2 and 3 are string and not integer?
Following is the example data that comes from the .csv file
FEDERAL TAX,1084,0000
COREHCR,1084,00 00
CLIENT P,1084,0000
The select is:
Dim da2 As New OleDb.OleDbData Adapter("Select * from " &
"CorelandGLConv ersion.csv", conn)
The problem is that it thinks the 3rd column is an integer and changes the
0000 to 0.
Can I tell it in the Select statement that the column is a varChar? I
can't do it after reading in the data as the data will already have
changed the 0000 to 0 at that point.
I tried to set up the table as:
Dim DTGLConversion as DataTable
DTGLConversion. Columns.Add("F1 ", System.Type.Get Type("System.St ring"))
DTGLConversion. Columns.Add("F2 ", System.Type.Get Type("System.St ring"))
DTGLConversion. Columns.Add("F3 ", System.Type.Get Type("System.St ring"))
da2.Fill(DTGLCo nversion)
DataSetObj.Tabl es.Add(DTGLConv ersion)
This sets up the columns as strings in the DTGLConversion Table and adds it
to the Dataset but it seems the Select in the DataAdapter must have already
converted the string "0000" to integer 0 and then when I filled the
DataTable it reconverted it to "0".
How do I fix this?
Thanks,
Tom- Hide quoted text -
- Show quoted text -
Try to use schema.ini file http://msdn.microsoft.com/library/de...a_ini_file.asp
I think it should be similar to this
[CorelandGLConve rsion.csv]
Format=Delimite d(;)
ColNameHeader=T rue
Col1=F1 Char
Col2=F2 Char
Col3=F3 Char
and place that file in the same folder as the CSV file
"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** **************@ y66g2000hsf.goo glegroups.com.. .
On Mar 28, 5:11 am, "tshad" <t...@home.comw rote:
>"tshad" <t...@home.comw rote in message
news:u5******* ******@TK2MSFTN GP05.phx.gbl...
How do I tell DataAdapter that Column 2 and 3 are string and not
integer?
Following is the example data that comes from the .csv file
FEDERAL TAX,1084,0000
COREHCR,1084,00 00
CLIENT P,1084,0000
The select is:
Dim da2 As New OleDb.OleDbData Adapter("Select * from " &
"CorelandGLConv ersion.csv", conn)
The problem is that it thinks the 3rd column is an integer and changes
the
0000 to 0.
Can I tell it in the Select statement that the column is a varChar? I
can't do it after reading in the data as the data will already have
changed the 0000 to 0 at that point.
I tried to set up the table as:
Dim DTGLConversion as DataTable
DTGLConversion .Columns.Add("F 1", System.Type.Get Type("System.St ring")) DTGLConversion .Columns.Add("F 2", System.Type.Get Type("System.St ring")) DTGLConversion .Columns.Add("F 3", System.Type.Get Type("System.St ring"))
da2.Fill(DTGLC onversion) DataSetObj.Tab les.Add(DTGLCon version)
This sets up the columns as strings in the DTGLConversion Table and adds it to the Dataset but it seems the Select in the DataAdapter must have already converted the string "0000" to integer 0 and then when I filled the DataTable it reconverted it to "0".
How do I fix this?
Thanks,
Tom- Hide quoted text -
- Show quoted text -
Try to use schema.ini file
http://msdn.microsoft.com/library/de...a_ini_file.asp
I think it should be similar to this
[CorelandGLConve rsion.csv]
Format=Delimite d(;)
ColNameHeader=T rue
Col1=F1 Char
Col2=F2 Char
Col3=F3 Char
and place that file in the same folder as the CSV file
It almost works. It does give me everything. But it doesn't split each
line into 3 columns.
It makes each line one columns and ignores the comma separators. If I
change the name of the file in the schema file (so that it doesn't use it),
it splits each line (row) into 3 columns.
column 1 = FEDERAL TAX,1084,0000
column 2 = Null
column 3 = Null
If I leave out the schema.ini file (or just change the file name in the
file), I get:
column 1 = FEDERAL TAX
column 2 = 1084
column 3 = 0
Thanks,
Tom
Found it.
I needed to have:
Format=CSVDelim ited
in my file.
Thanks,
Tom
"tshad" <t@home.comwrot e in message
news:Op******** ******@TK2MSFTN GP06.phx.gbl...
"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** **************@ y66g2000hsf.goo glegroups.com.. .
>On Mar 28, 5:11 am, "tshad" <t...@home.comw rote:
>>"tshad" <t...@home.comw rote in message
news:u5****** *******@TK2MSFT NGP05.phx.gbl.. .
How do I tell DataAdapter that Column 2 and 3 are string and not integer? Following is the example data that comes from the .csv file
FEDERAL TAX,1084,0000 COREHCR,1084,0 000 CLIENT P,1084,0000
The select is:
Dim da2 As New OleDb.OleDbData Adapter("Select * from " & "CorelandGLCon version.csv", conn)
The problem is that it thinks the 3rd column is an integer and changes the 0000 to 0.
Can I tell it in the Select statement that the column is a varChar? I can't do it after reading in the data as the data will already have changed the 0000 to 0 at that point.
I tried to set up the table as:
Dim DTGLConversion as DataTable
DTGLConversio n.Columns.Add(" F1", System.Type.Get Type("System.St ring")) DTGLConversio n.Columns.Add(" F2", System.Type.Get Type("System.St ring")) DTGLConversio n.Columns.Add(" F3", System.Type.Get Type("System.St ring"))
da2.Fill(DTGL Conversion) DataSetObj.Ta bles.Add(DTGLCo nversion)
This sets up the columns as strings in the DTGLConversion Table and adds it to the Dataset but it seems the Select in the DataAdapter must have already converted the string "0000" to integer 0 and then when I filled the DataTable it reconverted it to "0".
How do I fix this?
Thanks,
Tom- Hide quoted text -
- Show quoted text -
Try to use schema.ini file
http://msdn.microsoft.com/library/de...a_ini_file.asp
I think it should be similar to this
[CorelandGLConve rsion.csv] Format=Delimit ed(;) ColNameHeader= True Col1=F1 Char Col2=F2 Char Col3=F3 Char
and place that file in the same folder as the CSV file
It almost works. It does give me everything. But it doesn't split each
line into 3 columns.
It makes each line one columns and ignores the comma separators. If I
change the name of the file in the schema file (so that it doesn't use
it), it splits each line (row) into 3 columns.
column 1 = FEDERAL TAX,1084,0000
column 2 = Null
column 3 = Null
If I leave out the schema.ini file (or just change the file name in the
file), I get:
column 1 = FEDERAL TAX
column 2 = 1084
column 3 = 0
Thanks,
Tom
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: randy |
last post by:
Hello all,
I have a DataTable which I am building column by column and adding rows
after each new column. The DataTable columns match the columns in my
database table. I'm building the DataTable first and I then want to roll
through the DataTable while in memory checking for errors and then commit
the rows to my database table (btw this is in ASP.NET). Is it possible to
have data in a datable before attaching at DataAdapter? I'm a...
|
by: hch |
last post by:
dataAdapter.Update(data, "TableName") won’t work!
I was about to deploy my first website on the Internet only to discover that
the dataAdapter.Update() throws the Server Error in the third underline. It
was working fine before.
ConnectionString in Web.config:
-----------------------------------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
|
by: Eric A. Johnson |
last post by:
I'm using ADO style. I have an Access database with four tables that I will
want to do queries on. I will want to do queries on all four tables, at
least individually, and possibly at the same time (using "INNER JOIN"). My
question: Is it better to have four individual DataAdapters, one for each
table, with the DataSet linking to a different one for each query; one
single DataAdapter, that would connect to all four tables at once; or some...
|
by: Tom Luetz II |
last post by:
I'm having some trouble with the DataAdapter in my code. When the parameter
in an OleDbCommand, which is created
as having a type of OleDbType.Decimal, is set to System.DbNull, the actual
value posted to the database upon execution of the Insert command is a
floating point value of zero (0.0, actually).
The DataAdapter is associated with a DataGrid. When a row is inserted into
the grid, the column may contain either nothing "(null)"
or...
|
by: Siv |
last post by:
Hi,
I seem to be having a problem with a DataAdapter against an Access database.
My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable.
I then proceed to update a list to reflect that the 3 items have been
deleted only to discover that the 3 items appear, however when I click on
them to display their information which runs a datareader over the same
database it appears that the data has now gone.
I wondered whether...
| |
by: jonefer |
last post by:
I'm creating a simple search for Members, with possible 4 search parameters:
Name, SSN, DOB, SEX, but (just beginning ASP.NET/VB.NET) I'm fearing that I
will need to create a dataadapter for every possible combination of fields
entered to eliminate a blank parameter.
Does a parameterized DataAdapter automatically take care of this so I can
use the following SQL without having to worry about blank textboxes?:
SELECT * From Membership...
|
by: Rich |
last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn)
dim tblx As New DataTable
da.Fill(tblx) '--works OK up to this point
da.UpdateCommand = New SqlCommand
da.UpdateCommand.Connection = conn
da.UpdateCommand.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1"
da.Update(tblx) '--tblx/tbl1 not getting updated here.
|
by: Rich |
last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and
dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)?
Dim da As SqlDataAdapter
conn.Open
da.SelectCommand = New SqlCommand
da.SelectCommand.Connectoin = conn
da.SelectCommand.CommandType = Command.Text
da.SelectCommand.CommandText = "insert Into tbl1 Select * from tbl2"
da.SelectCommand.ExecuteNonQuery
|
by: tshad |
last post by:
How do I tell DataAdapter that Column 2 and 3 are string and not integer?
Following is the example data that comes from the .csv file
FEDERAL TAX,1084,0000
COREHCR,1084,0000
CLIENT P,1084,0000
The select is:
OleDbDataAdapter da2 As New OleDb.OleDbDataAdapter("Select * from " &
|
by: Newbie |
last post by:
Hi,
I have a dataadapter that contains just a single record.
Dim SqlDataAdapterValues As New SqlDataAdapter("select * from
tbl_formatvalue where format_id = " & intFormatInt, dbConnectionIn)
SqlDataAdapterJobs.Fill(dsFormats, "formatvalues")
I want to get the value for column customer_id from this dataset.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |