.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to INSERT Decimal value into a .DBF file using VS2005

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :


I use this code to connect into my Database:

db2 = New ADODB.Connection

dbConn = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=C:\PATH\;





inside my app, I use this command to INSERT into .DBF named testInsert.DBF,
the testInsert.dbf has the feilds of: Name( string format) & Amount(Decimal format)


Dim Conn as String

Conn="INSERT INTO testInsert.DBF VALUES ('shippers06','625.06')"


In this Coding, the VS2005 returms me an error of "DATA TYPE mismatch"

I try to Convert the value 625.06 to Decimal but it just don't work...

Please HELP a noobie like me in finishing this app...

Thnx in Advance

View Complete Post

More Related Resource Links

Insert into SQL Server with ajax file uploader


I am getting error in here 


Incorrect syntax near '987'

987 is where i put clientname.text

        Dim objCmd As New SqlCommand("Create Table " + clientname.Text + "(name Varchar(50), event Varchar(50), date1 datetime, username Varchar(50), password Varchar(50), " + strCommandText + ")", objConn)

        objCmd.CommandType = CommandType.Text

        Dim objConn2 As New SqlConnection("Data Source=dddd.db.2.hostedresource.com; Initial Catalog=mrpoteat; User ID=xxxxx; Password=xxxxxx;")
        Dim strCommandText2 As String = ""
        For index2 = 1 To Attachments1.Items.Count Step 1
            If String.IsNullOrEmpty(strCommandText2) Then
                strCommandText = "@pic" + index2.ToString()

Insert image into Infopath form and save to SharePoint as PDF file


I have an InfoPath web-enabled form in MOSS 2007, that is integrated with a K2 blackpoint process for an approval workflow.

Once the form (a Purchase Order request form) has been approved in the K2 workflow process, I switch the form view to a "print-friendly" view for the requestor to view from the browser.  However, now I need to go one step further with this scenario:

1) I need to somehow insert/embed an image with the scanned-in signature of the approver (likely stored in a SP doc library) at the signature line section of my form.  Also, what are the security requirements for storing such images, but not granting all users access to these (e.g. only services accounts that need to access this for embedding into the form, etc.)?

2) Then I need to convert this final "print-friendly" view of the form (with the signature image) to a PDF document so that I can store it in SharePoint (and email it to the requestor using K2's email event capabilities).

Can anyone help me with a solution to both of these requirement, or point me to some resources for this (even 3rd party components are open-game).



Insert Excel Data via File Upload into sql server database???

Hi all, I have requirement that User can Upload the Excel Sheet Data to sql server Database at once. How i do that Any Article or hint is apperciated.   Regards 

Insert Into SQL Server, With Current File Uploader Count

I have a Multiple File Uploader named "Attachments1" , and to get the cound I used "Attachments1.items.count"... then I have a Insert Into Command for SQL Server, that Inserts information into the table for every item in "Attachments1", you can see the below code... For Each item As AttachmentItem In Attachments1.Items             Dim objConn2 As New SqlConnection("Data Source=XXX")             objConn2.Open()             Dim objCmd2 As New SqlCommand("INSERT INTO clientport (name, event, phone, email, date1, password, path, path2, filename, number)" & "VALUES (@name, @event, @phone, @email, @date1, @password, @path, @path2, @filename, @number)", objConn2) But for the "number" Column, I would like to insert the Count for that file... For example if Attachments1 has 3 files it will insert into the database the time (which works fine)  the probem is the number column doesnt make file1 for the first file, file 2 for the second file, and file3 for the third file... Instead it puts file3 for all three rows when it Inserts into the DB.  my code is below to get the count.   Dim strcommandtext As String = ""    

How can we insert csv file data into Sql server table based on some condition ?


Hello All experts there,


I need to insert some csv file data into sql server 2008. but there are multiple tables created in sql server and I need to check some conditions before data insertion and based on the condition value, sql script should insert the data in to specific table. in other words I need to insert data from one csv file to different tables based on some condition.

is it possible? if yes then can anyone please give me an idea on how can we do that?


Thanks in advance


Nipendra Garg




<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
WIDTH="550" HEIGHT="400" id="myMovieName">
<PARAM NAME=movie VALUE="myFlashMovie.swf">
<PARAM NAME=quality VALUE=high>
<EMBED src="/support/flash/ts/documents/myFlashMovie.swf" quality=high bgcolor=#FFFFFF WIDTH="550" HEIGHT="400"
NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"


Insert Data to table from excel file


guys, i am new to sql development

my question is how do i import data from an excel table,

i was trying to do it via a query and just paste the values, but received a syntax error. thanks

data structure is:


how to insert a path file into an array and listview using openfiledialog with multiselect property?



i have problem to insert path file into an array and listview(detail) using open file dialog wit multiselect property, please give me sample to make it?

Insert spaces to get fixed length fields for flat file export



I have a query which extracts all the required data from a database and I need to load this data into a Text File. I am using a SSIS package to do this.

Now this file should have data in the format given below

437856785        A20101009This is construction         124728347

i.e the receiving file has no delimiters and each field is determined with a fixed length(fixed number of characters). The data I get out of my query for example for the first column returns just the value 437856785 and I need to append spaces to it to achieve the fixed length. I need to do to this kind of appending spaces to all the columns. Please suggest me ways to do this.

Thanks in advance..



How to insert Database and Upload file


I have TBL_PRODUCT table : ProductID, ProductName, CategoryID, Image.

I can insert data to table :

public ActionResult Create(tbl_products products)

       return Redirect("Index");

I can upload image file too

public ActionResult UpHinh(HttpPostedFileBase fileImg)
       var fileName = Path.GetFileName(fileImg.FileName);
       fileImg.SaveAs(Server.MapPath("/Content/Images/" + fileName));

       return Redirect("Index");

But I want two function become one. When I press <Submit>, it's insert data and upload image file.

Help me. Thanks

INSERT NULL value in SQL database when there is no file to upload



I've been working on a code that allows users to upload images (jpgs) as an optional field. Alhough the uploading works, I'm struggling when the user doesn't have an image to upload. I can't seem to find the way to NOT insert binary data into my database, I just want an NULL value when there is no image.
I get this error message: ...expects parameter @Image, which was not supplied.


Here is the code: 

Sub InsertItem()

Dim imageData As Byte() = Nothing
Dim MIMEType As String = ""


Create XML file after inserT





I'd like to create a xml file after a insert of a record automaticlly how does I solve this?

I know I can create a trigger to do something after a insert but how to create an xml file and place it somewhere.


using SQL Server 2005





Precision and scale from flat file with no decimal point


I can't figure out if "precision" and "scale" in flat files connection manager can give me an implied decimal. 

Say each record is an amount and a name:



The numbers represent 1.01 and 1.02

I would hope I could put in the flat file something to say the Scale is 2 and Precision is 5, and down-pipeline tasks would see 1.01 and 1.02.  I've tried dt_numeric and dt_decimal data types in my flat file connection manager advanced properties and tried setting DataScale to 2 and (in numeric, no such option in decimal) setting DataPrecision to 5, but the numbers just come out as 101 and 102 when I write them into an ODBC database. 


Would you expect this to work (I'm doing the right thing wrong) or is there something similar (I'm doing the wrong thing)?

In fact what I have is dozen of currency fields and percentages with no decimal points - old Cobol style data we get from competitors who won't change the format.  I realize that I could transform the field(s) but then that has to be done for each dataflow that uses the connection manager.


SqlBulkCopy How to Use to Insert Data From text CSV file to Sql Table



I am New to using the  SqlBulkCopy Can any one tell me how to use it and how many rows maximum we can insert using the SqlBulkCopy

how to habdle the  exceptions when bulkcopy inserting

SQL BULK INSERT, WITH FORMAT FILE and Hyperterminal file


Hello, I have a SQL Table, into which I am attempting to do a Bulk Insert With FormatFile.  I have SQL Server 2005, and a hyperterminal output from our phone system (PartnerMail).  I can't seem to get this to work ... Not Sure how to deal with the "Sometimes-there's-a-Double" time at the end ... And not sure of the 'MaxBytes' value (the second zero) ...

I keep getting one of two error messages, depending on what I mess with: 

Msg 8152, Level 16, State 14, Line 1

String or binary data would be truncated.

The statement has been terminated.


Msg 4832, Level 16, State 1, Line 1

Bulk load: An unexpected end of file was encountered in the data file.

Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7330, Level 16, State 2, Line 1

Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

Any suggestions?


File Splitter in .Net

I love to do utility programs in .Net. And this is one of them. As I was playing with JSplit (a free file splitter program), I wondered if I could do it in .Net. The framework supports file operations like reading files in bytes and creating them. It is indeed easy to do file operations in .Net Basics on File operations

Upload Multiple File using JQuery in asp.net

In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend