Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2006, 01:55 PM
Authorized User
 
Join Date: Jul 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems inserting into a temporal table sqlser05

Hi there, i hope you can help me.

I'm using visual basic 6 and sql server 2005, i've made a process that reads a batch of .txt, then after processing the data in those files, certain registries must be inserted in a specific table,but if an error happens then that data have to be discarded.

My problem is this, i want to create a temporal table to process the data, and if no error occurs, i copy that data to the specified table.
So far i'm doing this:

Code:
RegistrosRecordset.Open "CREATE TABLE [#NoPagadosDetalle]([Referencia] [nchar](10) COLLATE Modern_Spanish_CI_AS NOT NULL,[Cuenta] [nchar](18) COLLATE Modern_Spanish_CI_AS NOT NULL,[Sucursal] [nchar](4) COLLATE Modern_Spanish_CI_AS NOT NULL,[TipoCuenta] [nchar](2) COLLATE  Modern_Spanish_CI_AS NOT NULL) ON [PRIMARY]", ConexionBD
to create the temporal table(that is the table script in sql s2005), then

Code:
RegistrosRecordset.Open "insert Into #NoPagadosDetalle (Referencia,Cuenta,Sucursal,TipoCuenta,NSS,ImporteAbono,GrupoFamiliar,FechaPago,Motivo,CveSubdelegacion,Archivo) values('" & Mid(registros, 1, 10) & "','" & Mid(registros, 11, 18) & "')", ConexionBD
That is my insert, but i got the following error:

error [Microsoft][SQL Native Client][SQL Server]Invalid object name #NoPagadosDetalle

the weird thing is this, while i'm debuggin it step by step after the error occurs, it works correctly.

Any ideas ?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting new field to a table elygp SQL Language 3 March 19th, 2008 12:03 PM
Inserting a value from one table to another Hudson40 Access VBA 1 February 25th, 2005 08:54 AM
copying from table 1 inserting in table 2 gilgalbiblewheel Java GUI 0 September 15th, 2004 03:40 PM
ASP 3.0 - Problems Inserting into Database w/ SQL Sunday Ironfoot ASP.NET 1.0 and 1.1 Basics 1 May 5th, 2004 02:41 PM
Inserting table in RichTextbox agarwalmk VS.NET 2002/2003 0 February 11th, 2004 05:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.