SQL Connection Not Terminated Immediately

Aug 16, 2006

Hi,

    I have a web application that connects to a SQL server 2000. My problem is when my application accesses the SQL server to retrive data it creates a new connection to the SQL server. So during the running of the application there would be multiple connection of my application to the SQL server. Is there a way that i can close the connection after each query.

 

Thank you.

 

View 3 Replies


ADVERTISEMENT

Leave The Connection Open Or Always Open And Close Immediately?

Jun 7, 2006

Hi there,
 
I got an approach like that:
1) Read something from DB - check the value, if true stop if false go on2) Read the second Value (another SQL Statement) - check the value etc.
Now I could open the connection at 1) and if I have to go to 2) I leave the connection open and use the same connection at 2). Is it ok to do that?
The other scenario would be opening a connection at 1), immediately close it after I read the value and open a new connection at 2).
Thanks for the input!

View 4 Replies View Related

Mirror And Witness Connection In A Disconnected State Immediately After Adding Witness Server To Mirror Session.

Jan 31, 2008


After adding the Witness Server to the Mirror session, the Witness Connection state between the Mirror and Witness Connection is Disconnected and the state between Principal and Witness Connection is Connected.

The procedures defined in Books Online was used to setup Database Mirroring...when the Witness server was added to the Mirror session, only the alter database T-SQL statement was executed on the Principal server.

ALTER DATABASE <db_name> SET WITNESS = 'TCP://<servername>:<port>'

After executing the above statement, a few seconds later the state between Principal and Witness Connection changed to Connected and the state between Mirror and Witness Connection remains Disconnected.

The Mirror session is not using Certificates, every server is on the same domain, using the same domain login account, and all servers have SP2 installed running Enterprise Edition.

Any idea's why the state between Mirror and Witness Connection remains Disconnected?

Thanks,

View 9 Replies View Related

Please Help Immediately...

Feb 21, 2007

Hello everyone...
plzz help me,im getting this error whenever i want to connect my pc with another remote pc which i've designated as Server and my database is saved there so i want to connect my pc with tht remote pc and save data entered by my pc to that remote pc's database...
but i get this error....PLEASE HELP IMMEDIATELY...





Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (.Net SqlClient Data Provider)

----------------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476

----------------------------------------
Error Number: -2
Severity: 11
State: 0


----------------------------------------
Program Location:

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()

View 3 Replies View Related

Hi, I Need Ur Urgent Help Immediately(!!!!)

Aug 24, 2006

i have a sql data table which icludes names and surnames
as like as that:
george read
hasan hujtr
deem greg
ade ad
edy es
---------------
i need a "select" query to receive only people whom surnames composed merely two letters(ade ad, edy es).
thanks,
best regards.

View 5 Replies View Related

How To ID When I Have Insert The New Record Immediately

Jan 29, 2006

hi all,i have a question that how to get id afer insert  a new record.i just read from the following article, but still can't get the meaning:http://forums.asp.net/1008337/ShowPost.aspx
and my code             Dim sql_3 As String            sql_3 = "insert into paper_type (name, enable,creation_date,lastupdate,user_id) values "            sql_3 += "('" & name & "','" & enable & "', getdate() ,getdate ," & user_id & ")"            Call OpenRs(sql_3)            ' I want to get the id immediately, but how?? (i am using sql server)   can somebody help me to solve the problem??thanks a lot

View 9 Replies View Related

Client Configurations----immediately

Aug 2, 2000

Hi ,
I am configuring odbc connection at my users place, i tried to change his client configuration , but it is not going in. What was the problem why it is not going in.pls suggest me.
i am having sql7.
--chowdary

View 4 Replies View Related

How To Retrieve Rows Which Immediately After A ID

May 26, 2008

Hello..

Can any one you help me in retrieving the rows which immediately after a ID 9.
i.e, My condition is to retrieve the Record which immediately follows the event 9.
The retrieved record event should be in (24,25,26)

Table structure is
---------------------------------------------
MatchID SegmentID Event Player1 Player1ClubID
---------------------------------------------
1 0 9 1 88
1 0 24 1 89
1 0 10 1 88
1 0 9 1 89
1 0 25 1 88
1 0 10 1 88
1 0 10 1 89
1 0 10 1 89
----------------------------------------------

My out put should have
---------------------------------------------
MatchID SegmentID Event Player1 Player1ClubID
---------------------------------------------
1 0 24 1 89
1 0 25 1 88
---------------------------------------------

How to get this,
Can any one help me.

Thanks
Ganesh

Solutions are easy. Understanding the problem, now, that's the hard part

View 5 Replies View Related

Install SP1 Immediately After RTM Might Fail ... ?

Jun 28, 2006

Hi all,

maybe this is not a new issue? anyway:

Installing SP1 straight after the RTM (no delay between the finish of RTM install and start of SP1 install) might fail. This happened to me on an install of Analysis services install, but I guess it could happen on any install. I think in this case the reason is that the .NET Optimizer service is still busy generiting the native images of the assemblies and the SP1 install finds them locked.After a while, if you don't keep pushing the "Try Again" button you get an error message prompting to send the error report to MS (I got that twice), however in the background the installer continues. At the end the hotfix installation complete window states "Failure" for some components but the summary log contains "Not applied" (??).

If you let the optimizer finish its job then there is no issue...

Wonder how it works with silent install?

View 1 Replies View Related

The Statement Has Been Terminated

Mar 3, 2008



hi,
I am getting this error which says:
Details: ADO error code:0x80040e57
Description: statement has been terminated
SQL state:01000
Native error: 3621

thanks.

View 1 Replies View Related

Add A New Column In Temp Table In Sp Cannot Be Used Immediately

Jun 18, 2007

I created a temp table in my stored procedure and then added a new identity column to it.
However, I am not able to use this new column immediately, it says column not found.
SELECT * INTO #temp FROM table_name
ALTER TABLE #temp ADD  __Identity int IDENTITY(1,1)
SELECT * FROM #temp WHERE __Identity >= 10
Here __Identity column is not found. If I just did SELECT * FROM #temp without the where clause, the final result does have the __Identity column correctly added to the table. Why can't I query it?
Thanks!
 

View 4 Replies View Related

SQL Agent Job Fails Immediately After Invoked

Jul 23, 2005

Hey everyone --I've been having this problem for a couple weeks and was hoping maybesomeone can help out a little bit.Synopsis:This SQL agent job contains code to perform a full database backup withverification and is writing to a local disk array. I typically also usesome code for reporting - declaring variables and inserting them intoa linked server database that I use to monitor all my database backups.I have tested and used the code repeatedly and am confident it works.I have ran the code through Query Analyzer and it completes withsuccess.I have removed reporting code & used only the backup statement & itfails.I have 4 other Agent jobs doing other various tasks that function asexpected.I have tried deleting & recreating the job & it still fails.When I enable logging the application log has only one entry for SQLAgent:Event Type:WarningEvent Source:SQLSERVERAGENTEvent Category:Job EngineEvent ID:208Date:1/4/2005Time:9:36:00 AMUser:N/AComputer:ComputerNameDescription:SQL Server Scheduled Job 'DBName Full DB Backup'(0xA4B14FB5A5DE964B8340423E4AC4B67B) - Status: Failed - Invoked on:2005-01-04 09:36:00 - Message: The job failed. The Job was invoked byUser domainUserName. The last step to run was step 1 (Step 1).Any help or ideas would be greatly appreciated. I'm racking my brainhere and for some reason just not able to think of what the problem is.ChaddJoin Bytes!

View 9 Replies View Related

SQLServerAgent Terminated (forcefully)

Sep 19, 2000

I'm running SQLServer 7.0. When trying to open the <server>ManagementSQL Server AgentJobs window from Enterprise manager, the SQLServerAgent terminates with the following messages written to the sqlagent.out file in the logs directory:
19.09.2000 10:01:43 - ! [LOG] Exception 5 caught at line 321 of file ..srcjob.c. SQLServerAgent initiating self-termination
19.09.2000 10:01:58 - + [188] Scheduler engine timed out (after 15 seconds) waiting for 1 jobs(s) to stop
19.09.2000 10:01:59 - + [098] SQLServerAgent terminated (forcefully)

What could cause this error?

View 2 Replies View Related

INSERT Command Terminated

Feb 24, 2008

Hello,

I am having a strange problem with SQL server 2000.
Basically I am trying to insert data into only one field within a table that has two fields.

--------------
field1 | field2 |
--------------

if i use the statement:

Code:

INSERT INTO tableName (field2) VALUES ('value')

I am greeted by the error messgae: The statement has been terminated.

However If I try it this way:

Code:

IINSERT INTO tableName VALUES ('','value')


The statement works fine.
I am unable to enter data by referencing the field name explicitly. Has anyone ever seen this before?

View 3 Replies View Related

Terminated Update Script

Feb 15, 2008

String or binary data would be truncated.
The statement has been terminated.-- i got this message what it suppose to mean? Thanks Please help..

View 14 Replies View Related

Duplicate Key Ignored AND Statement Terminated

Mar 20, 2008

I have a table with a unique non-clustered index on it. It has theIGNORE_DUP_KEY option on.For some reason, I am getting the following error:-----------------------------------------------------------------------------System.Data.SqlClient.SqlException: Cannot insert duplicate key row inobject 'dbo.table1 with unique index 'IX_table1'.Duplicate key was ignored.The statement has been terminated.------------------------------------------------------------------------------It says the duplicate key was ignored, yet the statement is stillterminatedIs this data related?Other databases in the instance are working fine, and this one wasdoing okay, too.We're running SQL Server 2005 SP2 with rollup 3; 64-bit; clustered;thanks for any insight . . . .traceable

View 1 Replies View Related

Kicking Off A Scheduled Report Immediately In An Ad Hoc Manner...

Mar 20, 2008

We have a number of scheduled reports in our system. But frequently, I
need to kick off one or more of them immediately at random times - to
run off schedule, so to speak. The only way I know to do this is to
actually modify the schedule to set it to run "Once", set the time to
run to be a minute or so into the future, then wait for the report to
run. Afterwards, I go back into the scheduler and re-establish the
original schedule.



Do you know of a way to do this without having to modify and disturb
the original schedule?

Thanks,

Behzad

View 3 Replies View Related

SQLServer Driver: The Statement Has Been Terminated

Aug 1, 2006

Dear All,

I have this VB application calling MSSQL through the ODBC connection. It was running fine in Win 2K, but there is following error in Win XP Prof:

[microsoft][ODBC SQL Server Driver][SQL Server] The statement has been terminated.

I notice the version of ODBC MSSQL driver in Win 2K is 2000.81.8053.00, while in Win XP is 2000.85.1117.00. Could it be the cause of the issue? How to resolve it? Can I replace the SQLSRV32.dll in the WINDOWSsystem32 folder directly?

Thanks for any hint!

Regds

View 4 Replies View Related

MSSQLSERVER Service Terminated Unexpectedly

Feb 20, 2007

Hi

For 15 days now my SQL server service is terminating with the following error

MSSQLSERVER service terminated unexpectedly. It has done this 2 Time(s).
This service terminates and restarts automatically and sometimes doesnt restart we have to mannuly start it again.
Event ID: 7034.

Version Details

Version: MSSQL Server 2000
Service Pack: 3a
Build: 8.0.0.760

I have checked many forums most of them suggest to apply the latest service pack. But the same error has been reported by sites having SP4 also.
Kindly help.

Thank you
wasim

View 2 Replies View Related

MSSQLSERVER Service Terminated Unexpectedly

Jul 20, 2005

HII have server MSDE 2000 SP3frequently server stopped, and print in log file information:1)17310 :SqlDumpExceptionHandler: Process 1984 generated fatal exception c0000005EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.2)17311 :SQL Server is aborting. Fatal exception c0000005 caught.3)The MSSQLSERVER service terminated unexpectedly.

View 2 Replies View Related

ReportServer Service Terminated Unexpectedly

Nov 14, 2007

I have been looking for some information regarding an error I have gotten several times on my production SQL Server 2000 box. Operating System is Windows Server 2003. The Reporting Services version is 8.00.878.00

Error is as follows:
The ReportServer service terminated unexpectedly. It has done this 3 time(s). The following corrective action will be taken in 60000 milliseconds: Restart the service.

The service restarts normally, or at least seems to, and Reporting Services work with no other issues. Received the error this morning (11/14); last time was on 10/31.

What can I do to prevent this from happening?

Thanks,
Cecily

View 4 Replies View Related

SQLServer 2000 SP4 Enterprise Manager Crashes Immediately...

Jun 6, 2006

Hello,I need some help with SQL Server 2000 SP4. I've been using thedeveloper product for a few years now on my PC with very few problems.Today when I try to start up Enterprise Manager, it crashesimmediately. I get the usual "Please tell Microsoft about this problem"dialog and if I click the 'click here' link, I'm presented with adialog that says:-------------------------------------------------Error signatureAppName: mmc.exe AppVer: 5.1.2600.2180 ModName: mmc.exeModVer: 5.1.2600.2180 Offset:0001f07eReporting detailsThis error report includes: blah, blah, blah...-------------------------------------------------I am running Windows XP with SP2. Also installed is Visual Studio 2003,Visual Studio 2005, and SQLServer 2005 (We're in the process ofmigration).All of these products have been running OK together for at least amonth until today. I'm not sure what changed, but obviously somethinghas. I tried uninstalling and reinstalling SQLServer 2000 & it's SP4,but no luck. Enterprise Manager still crashes immediately when I try tolaunch it.Could somebody please help me out?Thanks.

View 1 Replies View Related

How To Extract Auto-generated Int Identity PK Field Value Immediately After It's Made ?

Sep 12, 2007

Ok, let's say that I do a following inline INSERT statement..... 
INSERT INTO Car ( carMake, carModel ) VALUES ( 'Honda', 'S2000' )
When I do this, a carId int value will automatically be generated because it is the Car table's PK and is an int identity.  How do I obtain this value so I can immediately use it in let's say, the following example.
INSERT INTO Person ( carId ) VALUES ( @carId ) ..... where @carId is the value I need
Maybe you would say I should do something like.....
SELECT carId FROM Car WHERE carMake = 'Honda' AND carModel = 'S2000'
However, let's assume that the carMake and the carModel fields are NOT unique.  I'm sure there's an easy way to extract the new identity value (maybe even in the same query) as the INSERT, but I just don't know how.
Thanks.

View 10 Replies View Related

Merge Replication Downloading Rows Immediately After Uploading SQL 2005

Jan 9, 2007

Hi

I have noticed that four out of the 145 tables being replicated in my topology perform a mysterious update.

If I insert data at the subscriber then synchronise the upload is completed followed by immediate downloading of the same identical set of rows as updates.

Has anyone seen anything like this. I cannot see any difference in the filter joins or article settings compared to any other table in the system but these four consistently do this.

Publisher/Distributor: SQL 2005 SP1 on Win 2003 Server
Subscriber: SQL Express 2005 SP1 on Win XP SP2

Cheers
Rab

View 5 Replies View Related

Error Immediately On Creating New Integration Services Project In VS2005

Aug 15, 2007

I am creating my first Integration Services project and am getting an
error immediately after creating the project. The error is in the
designer and it displays a red X, saying "Microsoft Visual Studio is
unable to load this document: Object reference not set to an instance
of an object". Clicking on the error in the error window just opens up
the xml file which contains the following:



<?xml version="1.0"?><DTS:Executable xmlnsTS="www.microsoft.com/
SqlServer/Dts" DTS:ExecutableType="MSDTS.Package.1"><DTSroperty
DTS:Name="PackageFormatVersion">2</DTSroperty><DTSroperty
DTS:Name="VersionComments"></DTSroperty><DTSroperty
DTS:Name="CreatorName">BNHO1mbell</DTSroperty><DTSroperty
DTS:Name="CreatorComputerName">BT4WKS1361</DTSroperty><DTSroperty
DTS:Name="CreationDate" DTSataType="7">8/14/2007 12:22:35 PM</
DTSroperty><DTSroperty DTS:Name="PackageType">5</
DTSroperty><DTSroperty DTS:Name="ProtectionLevel">1</
DTSroperty><DTSroperty DTS:Name="MaxConcurrentExecutables">-1</
DTSroperty><DTSroperty DTS:Name="PackagePriorityClass">0</
DTSroperty><DTSroperty DTS:Name="VersionMajor">1</
DTSroperty><DTSroperty DTS:Name="VersionMinor">0</
DTSroperty><DTSroperty DTS:Name="VersionBuild">0</
DTSroperty><DTSroperty
DTS:Name="VersionGUID">{834A3ADF-377D-4F01-88DC-1E0B5424B918}</
DTSroperty><DTSroperty DTS:Name="EnableConfig">0</
DTSroperty><DTSroperty DTS:Name="CheckpointFileName"></
DTSroperty><DTSroperty DTS:Name="SaveCheckpoints">0</
DTSroperty><DTSroperty DTS:Name="CheckpointUsage">0</
DTSroperty><DTSroperty DTS:Name="SuppressConfigurationWarnings">0</
DTSroperty><DTSroperty DTS:Name="ForceExecValue">0</
DTSroperty><DTSroperty DTS:Name="ExecValue" DTSataType="3">0</
DTSroperty><DTSroperty DTS:Name="ForceExecutionResult">-1</
DTSroperty><DTSroperty DTS:Name="Disabled">0</
DTSroperty><DTSroperty DTS:Name="FailPackageOnFailure">0</
DTSroperty><DTSroperty DTS:Name="FailParentOnFailure">0</
DTSroperty><DTSroperty DTS:Name="MaxErrorCount">1</
DTSroperty><DTSroperty DTS:Name="ISOLevel">1048576</
DTSroperty><DTSroperty DTS:Name="LocaleID">4105</
DTSroperty><DTSroperty DTS:Name="TransactionOption">1</
DTSroperty><DTSroperty DTS:Name="DelayValidation">0</DTSroperty>
<DTS:LoggingOptions><DTSroperty DTS:Name="LoggingMode">0</
DTSroperty><DTSroperty DTS:Name="FilterKind">1</
DTSroperty><DTSroperty DTS:Name="EventFilter" DTSataType="8"></
DTSroperty></DTS:LoggingOptions><DTSroperty
DTS:Name="ObjectName">Package</DTSroperty><DTSroperty
DTS:Name="DTSID">{433D7504-1A63-4960-86EB-8501C7A77A37}</
DTSroperty><DTSroperty DTS:Name="Description"></
DTSroperty><DTSroperty DTS:Name="CreationName">MSDTS.Package.1</
DTSroperty><DTSroperty DTS:Name="DisableEventHandlers">0</
DTSroperty></DTS:Executable>





I have VS2005 SP1, running WindowsXP SP2. Integration Services is
running on my machine, but I would think that this shouldn't matter
anyway as the error is happening before I have even indicated and data
source to use. If I take this xml file with the error and copy it to another new SSIS project on another machine, it works fine. Reinstalling VS2005 had no effect. I am now reinstalling SQL Server 2005 SP2 to see what effect that may have.





Any ideas?
Thanks,
Marcus

View 5 Replies View Related

SSMS - Getting Timeout Terminated Even With Execution Time-out Of 0?

Jul 6, 2007

On SSMS 9.00.3042.00, any query that runs longer than 10 minutes getsthe following error message:The statement has been terminated.Msg -2, Level 11, State 0, Line 0Timeout expired. The timeout period elapsed prior to completion ofthe operation or the server is not responding.I have changed the setting for Execution time-out to 0 in Tools-


Quote:

View 3 Replies View Related

Is There An Eventhandler That Can Be Triggered When Package Execution Is Terminated?

Apr 16, 2008

i have a package which logs to a table the status of its execution. i wonder if there is a way to trigger an event when package execution is terminated.

View 3 Replies View Related

How To Deal With:the Previous Statement Must Be Terminated With A Semicolon.

Apr 28, 2008



when I backup the SQL Server 2005 database ,always get prompt
Error description: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'E'.
+48166A04.0004 [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
+48166A04.0004 [Microsoft][ODBC SQL Server Driver][SQL Server]The label 'E' has already been declared. Label names must be unique within a query batch or stored procedure.}

how to deal with it, thanks

View 5 Replies View Related

MSSQLServer Service Terminated Unexpectedly MS-SQL 2000 With SP4

Jan 24, 2007

MSSQLServer service terminated unexpectedly

We are running SQL Server 2000 with SP4. This server has been running for the past six months with no SQL server problems. A Max of 10 users have access to the application running on this server.

The Event Viewer Log shows the
Source: MSSQLServer
Category: (2)
Type: Error
EventID: 17052
Description: The MSSQLSERVER service terminated unexpectedly.

No other error messages were seen in the SQL server log or windows event viewer.
The time when it terminated was not during peak load/activity.

The server is Windows 2003 with SP1. Any help would be appreciated.

View 5 Replies View Related

String Or Binary Data Would Be Truncated.The Statement Has Been Terminated.

Jul 13, 2007

i am showing one field from database which is varchar and has length 1000, in the text box. i apend some text in the texbox and click update button.  on update button's click i UPDATE whole text again to database.
so when the 1000 limit crosses it stops appending text to datafield.
if i execute the query in query analyzer it shows error "String or binary data would be truncated.The statement has been terminated."
 on my web form how can i catch this sql exception so that i can give error message on the form?
thanks in advance

View 2 Replies View Related

String Or Binary Data Would Be Truncated.The Statement Has Been Terminated.

Oct 5, 2007

hi i am successfully uploading a image and that path is stored in label Now what i want is to store that label path(image path) in database not image only path
 while i executing this programe i got this error.This is code.I got error at sqlcmd.ExecuteNonQuery().
code:
labelRes1.Text = RadUploadContext.Current.UploadedFiles [File1.UniqueID].FileName;
 string imgpath = labelRes1.Text; SqlConnection sqlcon = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DiskEra;Data Source=MAINSERVER");
sqlcon.Open();
 SqlCommand sqlcmd = new SqlCommand("insert into tblCategories(ImagePath ) values (@ImagePath)", sqlcon);
sqlcmd.Parameters.AddWithValue("@ImagePath",imgpath );
sqlcmd.ExecuteNonQuery();
 
 priority: very very high
regards;
kishore
 

View 1 Replies View Related

String Or Binary Data Would Be Truncated. The Statement Has Been Terminated.

Jan 10, 2008

The code below the error produces the error, please help. String or binary data would be truncated.The statement has been
terminated. Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code. Exception Details:
System.Data.SqlClient.SqlException: String or binary data would be
truncated.The statement has been terminated.Source Error:




Line 236: ins.Parameters(i).Value = r(i)Line 237: NextLine 238: ins.ExecuteNonQuery()Line 239: 'If System.Threading.Interlocked.Increment(rowscopied) Mod 10000 = 0 ThenLine 240: 'Console.WriteLine("-- copied {0} rows.", rowscopied)Source
File: C:Inetpubwwwrootsitesmarketingappsdispositiondefault.aspx.vb
   Line: 238  -------------  Private Shared Sub InsertData(ByVal sourceTable As System.Data.DataTable, ByVal destConnection As SqlConnection)        ' old method: Lots of INSERT statements         Dim rowscopied As Integer = 0        ' first, create the insert command that we will call over and over:         destConnection.Open()        Using ins As New SqlCommand("INSERT INTO [tblAppointmentDisposition] ([contactdate], [dnbnumber], [prospectname], [businessofficer], [phonemeeting], [followupcalldate2], [phonemeetingappt], [followupcalldate3], [appointmentdate], [appointmentlocation], [appointmentkept], [applicationgenerated], [applicationgenerated2], [applicationgenerated3], [comments], [newaccount], [futureopportunity]) VALUES (@contactdate, @dnbnumber, @prospectname, @businessofficer, @phonemeeting, @followupcalldate2, @phonemeetingappt, @followupcalldate3, @appointmentdate, @appointmentlocation, @appointmentkept, @applicationgenerated, @applicationgenerated2, @applicationgenerated3, @comments, @newaccount, @futureopportunity)", destConnection)            ins.CommandType = CommandType.Text            ins.Parameters.Add("@contactdate", SqlDbType.NVarChar)            ins.Parameters.Add("@dnbnumber", SqlDbType.NVarChar)            ins.Parameters.Add("@prospectname", SqlDbType.Text)            ins.Parameters.Add("@businessofficer", SqlDbType.NChar)            ins.Parameters.Add("@phonemeeting", SqlDbType.NVarChar)            ins.Parameters.Add("@followupcalldate2", SqlDbType.NVarChar)            ins.Parameters.Add("@phonemeetingappt", SqlDbType.NVarChar)            ins.Parameters.Add("@followupcalldate3", SqlDbType.NVarChar)            ins.Parameters.Add("@appointmentdate", SqlDbType.NVarChar)            ins.Parameters.Add("@appointmentlocation", SqlDbType.NVarChar)            ins.Parameters.Add("@appointmentkept", SqlDbType.NVarChar)            ins.Parameters.Add("@applicationgenerated", SqlDbType.NVarChar)            ins.Parameters.Add("@applicationgenerated2", SqlDbType.NVarChar)            ins.Parameters.Add("@applicationgenerated3", SqlDbType.NVarChar)            ins.Parameters.Add("@comments", SqlDbType.Text)            ins.Parameters.Add("@newaccount", SqlDbType.NVarChar)            ins.Parameters.Add("@futureopportunity", SqlDbType.NVarChar)            ' and now, do the work:             For Each r As DataRow In sourceTable.Rows                For i As Integer = 0 To 16                    ins.Parameters(i).Value = r(i)                Next                ins.ExecuteNonQuery()                'If System.Threading.Interlocked.Increment(rowscopied) Mod 10000 = 0 Then                'Console.WriteLine("-- copied {0} rows.", rowscopied)                'End If            Next        End Using        destConnection.Close()    End Sub

View 2 Replies View Related

String Or Binary Data Would Be Truncated. The Statement Has Been Terminated.

Sep 30, 2004

I am working on Updating information from a table using Sql Server, but I keep receiving the error "String or binary data would be truncated. The statement has been terminated."
I have changed my maxlength of each textbox to equal the columns of my table but keep receiving the same answer. I also increased the lengths to make sure there was enough space, but no successful ending. Can anyone help? Here is my code and error message.

***************************************************************************
Sub btnSubmit_Click( s As Object, e As EventArgs )
Dim strUpdate As String
Dim cmdSelectData3 As SqlCommand
Dim conMyData As SqlConnection


conMyData = New SqlConnection("Server=helpdesk01; UID=sa;
PWD=****; database=ASPState" )


cmdSelectData3 = New SqlCommand("MemberUpdate", conMyData)
cmdSelectData3.CommandType = CommandType.StoredProcedure
cmdSelectData3.Parameters.Add("@MTitle", radMr.Text)
cmdSelectData3.Parameters.Add("@First", trim(txtFirstname.text))
cmdSelectData3.Parameters.Add("@Middle", trim(txtMiddlename.Text))
cmdSelectData3.Parameters.Add("@Last", trim(txtLastname.text))
cmdSelectData3.Parameters.Add("@Country", trim(dropCountry.SelectedItem.text))
cmdSelectData3.Parameters.Add("@Email", trim(txtEmail.text))
cmdSelectData3.Parameters.Add("@Promo", chkPromoUpdate.text)
cmdSelectData3.Parameters.Add("@Genre", trim(dropGenre.SelectedItem.text))

conMyData.Open()

cmdSelectData3.ExecuteNonQuery() (**error in Red**)

conMyData.Close()
End Sub


*************************************************************************

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved