|
You asked essentially the same question a month ago.
This isn't really a VB.NET question; it is more of a SQL question.
But, here is some help anyone.
Rather than checking to see if the record exists before inserting it, allow the insert to check if the record exists.
And, use a stored procedure instead of writing the SQL statments in the code.
Given these helps, you should be able to accomplish the task.
Tim
|
|
|
|
|
you said you have primary key table in the database.
So don't loop through each table rows with your records because it would take a lot of time
to loop through and execute the insert statement.
Better fire all the insert statements and catch the error message for primary key voilation and that's all. Your all the records that are not in the database will be saved and the other duplicate records will throw the exception saying it can't have duplicate primary key values.
enjoy
You can go to http://www.rprateek.blogspot.com[^] to get some more code for visual basic.
Interested in development projects
|
|
|
|
|
|
Am writing a search application and i require to spell check the words before being submitted to the search application. I am using MS word to accomplish this. it works ok but its too slow. Do you know a way out? I hoped .net has 'Did you mean' kind of a deal? does it?
Any thing am ready
|
|
|
|
|
Kanyungu wrote: I hoped .net has 'Did you mean' kind of a deal? does it?
Not that I am aware of. You might need to look at third party controls or implement one of your own.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Google use to have a SOAP API that you could use. I'm not sure if it's still available or not.
|
|
|
|
|
I have a spreadsheet showing a Purchase Order.
I wish to email it to the Supplier in a PDF format.
'Email The Order
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
"C:\DOCUME~1\David\LOCALS~1\Temp\" & strName & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Application.Dialogs(xlDialogSendMail).Show
This seems to be the right way of doing it as far as I can tell.
HOWEVER...
It sends in .xlms format and can be opened at receivers end as spreadsheet!
If I send it manually as PDF no probs.
Where am I going wrong?
------------------------------------
"Password Protected? Your dealing with Geeks, just turn it on, type Gandalf and you're in!" - Frankie Boyle
|
|
|
|
|
I've never used this call before, but, I ran a quick check in VBA.
It looks like Excel is going to e-mail the spreadsheet in a spreadsheet format, not the file is was saved as.
Having said that.... my advice is: save the file as a PDF, then send the PDF using other VBA code.
A search of how to e-mail in VBA should reveal results, if not, let me know.
Tim
|
|
|
|
|
That works.
It is a bit of a kludge, save file as PDF, send the PDF, erase the PDF file!
(Not elegant either, but as it works I shall leave it working now. Thanks for that!)
------------------------------------
"Password Protected? Your dealing with Geeks, just turn it on, type Gandalf and you're in!" - Frankie Boyle
|
|
|
|
|
looking for an alternative and efficient way to transfer table records from one database to another database.
could it be done with one sql?
ty in advance
maytel
|
|
|
|
|
If the databases are in the same server, and the database user account has access to both, you can easily copy data from one database to another:
insert into database2..someTable (oneField, anotherField)
select oneField, anotherField
from database1..SomeTable
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
ty for the prompt help
but could i ask for code sample?
insert into C:\database2...
select *
from c:\database1...
ty
|
|
|
|
|
What type of database? It looks like you may be talking access here?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
sorry yup im using access
|
|
|
|
|
maytel mynt wrote: using access
So use File-->Get External Data-->Import
to import the tables you want.
--------------------------------------------------------
Knowledge is knowing that the tomato is a fruit.
Wisdom is not putting it in fruit salad!!
|
|
|
|
|
The subject has asked it all.. but additionally, just wanna know how to simply use that component in windows app. Secondly how to add that component to toobox.
|
|
|
|
|
|
IIRC the latest release of code on CodePlex[^] is in VB2008.
Anyway - if you add the compiled dll to the references of a windows forms project the component should show up in the toolbox. If it doesn't try a "Rebuild All"...?
|
|
|
|
|
Hi,
i have listbox control which contains mutliple items and on checkbox checking multiple items are selected , now how i insert those selected items in data base using single insert statement .
please give me hint i google many times but didnot find any hint ,
regards
Rameez
|
|
|
|
|
rameez Raja wrote: how i insert those selected items in data base using single insert statement .
Any particular reason why you can't just loop through the collection of multiple items and insert them one at a time?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thanks for reply,
Actullay iam working on reservation application and listbox contains name of vehicles i want to store all slected vehicles .
you are right kindly write few lines of code how i do that .
loop throuh each items in listbox ? and store one by one
Regards
Rameez
Thnks in advance
|
|
|
|
|
If you are qualified to write the application then surely you can write code to loop through the selected items in a list box.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I second that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
rameez Raja wrote: kindly write few lines of code how i do that
No. Leaving it as a learning exercise for you to do.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|