A little more detail about what isnt working would be helpful. Also you should properly declare instances of each for you want to create.

Private Sub LoadForm3( )

Dim frm As New Form3

End Sub

Using database functionality you can read and write to an excel file without having to automate Excel as long as what you are writing following a consistent table structure. I definitely prefer this method it is very easy and doesnt require the user to even have Excel. However you do lose formatting options such as bolding cells. (ive been trying to find a way for the last month and havent been able to do so.)

I have already answered this with an example on the other board you posted the same question

You need to make a dynamic connection string. Meaning that you need a way to prompt the user (if the settings werent previously saved) to select the server & database they will be using and from there save your connection string.

The record is either added/inserted to the dataset/datatable or it is not. AcceptChanges will only change the rowstate (if it already exists in the dataset) of the record from New to Unchanged and will then prevent the record from then being saved to the database since the datatable sees it as unchanged.

Iammirko can you show an example of how your checking if this record is inserted? Also I dont see in this example where your creating an instance of this dataset and pointing the table adapter to it.

You dont need to automate Excel at all to output your dataset/datatable to an Excel file. You can use OLEDB to create your file.

Also Im not sure what the insert line is doing (the first line) you have already added the rows to the table in the first example unless you removed that coding too...

Altogether I would say the all that is needed is your orginal example which adds the new rows to your dataset & datatable and then the call to the DataAdapter.Update method right after that which saves all the changes in the datatable/dataset to the database.

Perfect sense, the DataAdapter.Update is what sends the new records to the database. The AcceptChanges isnt needed (its redundent), the call to the Update method automatically changes the records row state to Unchanged as it completes the update for each row. Calling the AcceptChanges after that changes any un-updated records to unchanged but since that was already done...

Take a look at AcceptChanges in the help file, it does not insert data to the database. I cant say much besides that since I dont know what else your code is doing.

The parameter should be an interger value not a string

Ok I'm lost I guess because this is marked as solved. AcceptChanges does not save the data to the database; it instead changes the row state properties of the dataset/datatable making the new records to UnChanged so that they cant be saved to a database when calling update.

Lots of different ways you can do the import but automatting Excel is probably the last one I would pick. First if you are importing directly from an Excel file, there is no reason to automate Excel at all. Using OLEDB you can read the values straight from the file into a dataset/datatable. This has an added advantage of not needing the user to also have the same version of Excel installed on the computer. Second there is no need to convert a CSV file before doing an import, there are many methods available for reading/importing delimited files. Not that it matters but you mention your using ODBC to read the Excel file, I dont see ODBC being used at all in your example.

I would suggest starting out by taking a look at the "TextFieldParser" in the help file. It has full examples for reading delimited files without the need to convert them to a different format.

Seem to be that it is expecting you to pass an integer value in the c.GetDisplayText function but instead you are passing a tab string. Of course im only taking a guess here since I dont know what your function parameters are...

None of the parameters even have datatypes defined.... An overflow error is usually caused by trying to force a bad value that doesnt fit into a specific datatype.

Time will automatically be applied as 12am thats why its better to use a between statement to give you all records for the specified day.

Also dont forget to include the # signs surrounding your date

Database's hold a DateTime value so its important to include the time such as using a between Todays date at 12:00am and tomorrows date

The field parameters seem to be correct unless im missing a misspelling somewhere between them. I would start by making two changes and see if you still have the same problem.

01) Convert the @DesignationID into an in (CInt(TxtDesigCode.Text))
02) Remove assigning them into PARAM (no clue what that is even doing there or where you are using it. However cmd is your command object and adding the parameters directly to that is all that is needed.

Last suggest is while stepping through the code, see exactly what values are being passed at the time of execution. If you are still having problems please give more detail to the error message that you are receiving.

Can you show your insert statement from the stored procedure? Without seeing it, I'm guessing either the parameters are wrong, missing or misspelled.

Also assuming that DesignationID is an numeric field I would suggest converting the textbox value to a numeric datatype (CInt(TxtDesigCode.Text))

Lastly there is no need of assigning anything to Param (Param = ...) change that so it just starts with the cmd.Parameters.AddWithValue(...

Leo, yes you can (and should) store the path and retrieve it and use that to load your images. To backtrack, you can upload pictures to the database (it is possible) but is a very bad practice to do so for reasons mentioned above. I'm glad you are reasonable enough to take the suggestions and opt to use a more efficient method.

As to your question, it is very general. What exactly do you need help with, creating a connection string, executing a query, loading the image?
Here is a link that will provide a lot of usefull examples for database programming from the MSDN:

I would need more details in order to help. What database are you using, what is you connection string etc.... Mark this thread as solved and start a new one about the connection strings and I will see if I can help.

Glad to help. Sorry there isnt an easier way or atleast one that I can find, I definitely need to accomplish the same thing for some forms. There is also one other way I know of that consists of using subreports. I didnt think to mention it because I have discounted them myself previously, too slow to load and print...

Glad it worked. You should have gotten a more clear descriptive error msg.... :(

Is this something you can upload including the db, so I can take a look at it?

Well in that update statement alone, the only think I can think of is UserName as being null when not expected, Did you change the column name Sales Orders in your database to be a single word? This has to match exactly? And I can picture an order number having a decimal point, are your sure the datatype in your database is the same? Lastly LockedForEdit is a string datatype in the db?

What is UserName and where is it coming from?

Saving pictures to a database isnt optimal and should be avoided if possible. Including pictures can greatly increase the size of your database and reduce the speed of its processing. Likewise everytime you update a record that contains a picture, even if your not touching the column with the picture, that record size is doubled in your db making it continue to grow.

It is much better to store the path of your picture in a database column and use that path to load your pictures when needed.

If you need any help just let me know. My example sends the report directly to the printer without displaying it on the screen first, but the same applies, set the footer size before displaying the reportviewer.

In case I made the above sound more complicated then it is, basically all Im doing is using the blank footer space to emulate the white space of any missing records so that in appearance the details section appears to be a fixed size.

I cant believe that there wasnt an easier solution to this but as said, I had the same problem and spent time researching it and this is the best that I could come up with for resolving the problem.

Just went through this exact situation a few weeks ago myself. Suprisingly there is [U]not [/U]an easy solution for this although I did find a work around.

There is no way to set the total height of the details section iteself, only the height of the individual item records. So the first thing you want to do is calculate the indivual record height and then the total for all 10 records. So say the height is 136 for each individual details record, total for 10 shown records should equal 1,360.

Ok under the details section add a Footer section to the report. If you are actually using a footer section, you can add an additional footer. You just want to make sure this blank footer is directly underneath the details section. Set this new blank footer to your total size: 1,360

Now Im not sure how your report is set us to draw the data. Are you allowing the report itself to query directly from the database or passing it a filled dataset? I'm doing the latter. Either way before you display the report you need to know how many records will be displayed so you can adjust the height programmiticaly.

Now the footer does allow us to adjust its height from VB. So I'm creating a blank section that would appear to be the size of 10 records if no records at all were returned. Now what we want to do is shrink this footer for each record that ...

I dont think this is your problem but your use of transactions is incorrect. In order for a transaction to work you either have to commit the changes or roll them back if it errors which I dont see being done.

The only other mistake I see is "Sales Order" if you have a space in your column name words, you much enclose the column name in brackets. [Sales Order]