dbTalk Databases Forums  

No Value Given For One Or More required Parameter

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss No Value Given For One Or More required Parameter in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jordan
 
Posts: n/a

Default No Value Given For One Or More required Parameter - 11-28-2005 , 05:07 AM






Hi,

I have set IMEX=1 and HDR=NO. I am referencing the excel columns as F1,
F2, etc...

The problem is sometimes in the excel files, not all the columns
referenced containes data. Thus I got the following error "No Value
Given For One Or More required Parameter" when the ExpandedColumnCount
in the excel file is less than the specified column.

Currently, I manually open the excel file, enter some data to the empty
columns, save the file, then delete the data I have just entered.
Anyone had any idea how to resolve this issue?

TIA.

-- Jordan


Reply With Quote
  #2  
Old   
Chiquita
 
Posts: n/a

Default RE: No Value Given For One Or More required Parameter - 12-09-2005 , 11:05 AM







"Jordan" wrote:

Quote:
Hi,

I have set IMEX=1 and HDR=NO. I am referencing the excel columns as F1,
F2, etc...

The problem is sometimes in the excel files, not all the columns
referenced containes data. Thus I got the following error "No Value
Given For One Or More required Parameter" when the ExpandedColumnCount
in the excel file is less than the specified column.

Currently, I manually open the excel file, enter some data to the empty
columns, save the file, then delete the data I have just entered.
Anyone had any idea how to resolve this issue?

TIA.

-- Jordan



As you loop through your Excel file, try looking at each Excel cell for
IsDBNull. I used the DataReader and have given you a sample of something I
am currently writing. Hope this helps. See the code sample below

--> Chiquita

Dim i As Integer
Dim myColumnValue as String
Dim myOleDBCommand As New System.Data.OleDb.OleDbCommand("Select * From
[Sheet1$]", myConnection)
Dim myOleDataReader As OleDb.OleDbDataReader = myOleDBCommand.ExecuteReader

myColumnValue = ""

Do While myOleDataReader.Read()

For i = 0 To myOleDataReader.FieldCount - 1

'Check to see if the value in the cell is NULL
If myOleDataReader.IsDBNull(i) Then
myColumnValue = ""
Else
'Since DataReader interprets the data, convert everything
to string values
myColumnValue = Cstr(myOleDataReader.Item(i))
End If

' DoSomethingWithYourColumnValue

Next
Loop

myOleDataReader.Close()
myConnection.Close()



Reply With Quote
Reply




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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.