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


ADVERTISEMENT

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

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

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

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

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

May 11, 2005

hello,
can you help to solve this problem. I have an asp.net application and when i try to insert the record in SqlServer table this error appears, just give me the solution please. iam so
String or binary data would be truncated. The statement has been terminated
Line 21:     cmd.Parameters.Add(New SQLParameter("@email", frmemail.text))Line 22:     myConn.open()Line 23:     cmd.ExecuteNonQueryLine 24:     MyConn.Close()Line 25:     label1.visible="true"

View 1 Replies View Related

Error Message String Or Binary Data Would Be Trunicated, The Statement Has Been Terminated

Jul 20, 2005

Dear All,I have written an update trigger that should write a message to an audittable When I try to update any field in the table I recieve the followingerror message -[ODBC Sql Server Driver] [Sql Server] Stirng or Binary data would betrunicated[ODBC Sql Server Driver] [Sql Server] The statement has been termined.I have looked and what has been suggested is to use the response.write len()to check the length of field that I am updating. Being fairly new toSQL-Server, I do not know how to do this. Any help will be most welcome.Thanks,Jeff

View 2 Replies View Related

Cannot Insert Duplicate Key Row In Object 'dbo.blabla..' With Unique Index 'Idx_blablabl'. The Statement Has Been Terminated. At

Jan 16, 2007

We are developing a project that is expected to hold TB of data and the back end used is SQL Server 2005.

I have the following problem

I have applied Nonclustered index over a column on a table.

Designed a SP for insertion which caters for updation incase the criteria based on the input is met.

The logic goes like this

Incase there exists a row containing the value of the column that is indexed for uniqueness, there should be updation. If not there should be a new row created.



However often there is an error message that is placed above. This happens only on some of the SPs and only on rare occasions.

Can any body tell me if there is any problem with the SQL Server 2005







Thanks in advance

R Suresh, SQLDBA







View 8 Replies View Related

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 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

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

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

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

System.Data.SqlClient.SqlException: Batch Execution Is Terminated Because Of Debugger Request

Aug 2, 2007

Batch execution is terminated because of debugger request.
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: Batch execution is terminated because of debugger request
any solution or cause of this exception
please let me know freindz 
 

View 8 Replies View Related

The SQL Server (SQLEXPRESS) Service Terminated With Service-specific Error 10013.

Jul 12, 2007

I have an almost virgin install of SQLExpres running on a WIN2K Pro system.

Have been able to create and connect db to Access 2000 without problem.



Now I wish to extend to remote connections. Using Surface Area Configuration tool, I changed Remote Connections to Local and Remote.

Whenever this setting contains TCP/IP and I try to restart the service I receive the following errors:



System Log:



The SQL Server (SQLEXPRESS) service terminated with service-specific error 10013.



Application Log:



Server TCP provider failed to listen on [ 'any' <ipv4> 0]. Tcp port is already in use.



TDSSNIClient initialization failed with error 0x271d, status code 0xa.



TDSSNIClient initialization failed with error 0x271d, status code 0x1.



Could not start the network library because of an internal error in the network library. To determine the cause, review the errors immediately preceding this one in the error log.



SQL Server could not spawn FRunCM thread. Check the SQL Server error log and the Windows event logs for information about possible related problems.





If I change back to Local Connections Only or Local and Remote using named pipes only, the service starts up again without a problem.



After five days of investigating, researching, reinstalling and waiting I have to ask for help.



Any suggestions or leads?



Thank You in advance.

View 14 Replies View Related

Multiple Tables Used In Select Statement Makes My Update Statement Not Work?

Aug 29, 2006

I am currently having this problem with gridview and detailview. When I drag either onto the page and set my select statement to pick from one table and then update that data through the gridview (lets say), the update works perfectly.  My problem is that the table I am pulling data from is mainly foreign keys.  So in order to hide the number values of the foreign keys, I select the string value columns from the tables that contain the primary keys.  I then use INNER JOIN in my SELECT so that I only get the data that pertains to the user I am looking to list and edit.  I run the "test query" and everything I need shows up as I want it.  I then go back to the gridview and change the fields which are foreign keys to templates.  When I edit the templates I bind the field that contains the string value of the given foreign key to the template.  This works great, because now the user will see string representation instead of the ID numbers that coinside with the string value.  So I run my webpage and everything show up as I want it to, all the data is correct and I get no errors.  I then click edit (as I have checked the "enable editing" box) and the gridview changes to edit mode.  I make my changes and then select "update."  When the page refreshes, and the gridview returns, the data is not updated and the original data is shown. I am sorry for so much typing, but I want to be as clear as possible with what I am doing.  The only thing I can see being the issue is that when I setup my SELECT and FROM to contain fields from multiple tables, the UPDATE then does not work.  When I remove all of my JOIN's and go back to foreign keys and one table the update works again.  Below is what I have for my SQL statements:------------------------------------------------------------------------------------------------------------------------------------- SELECT:SELECT People.FirstName, People.LastName, People.FullName, People.PropertyID, People.InviteTypeID, People.RSVP, People.Wheelchair, Property.[House/Day Hab], InviteType.InviteTypeName FROM (InviteType INNER JOIN (Property INNER JOIN People ON Property.PropertyID = People.PropertyID) ON InviteType.InviteTypeID = People.InviteTypeID) WHERE (People.PersonID = ?)UPDATE:UPDATE [People] SET [FirstName] = ?, [LastName] = ?, [FullName] = ?, [PropertyID] = ?, [InviteTypeID] = ?, [RSVP] = ?, [Wheelchair] = ? WHERE [PersonID] = ? ---------------------------------------------------------------------------------------------------------------------------------------The only fields I want to update are in [People].  My WHERE is based on a control that I use to select a person from a drop down list.  If I run the test query for the update while setting up my data source the query will update the record in the database.  It is when I try to make the update from the gridview that the data is not changed.  If anything is not clear please let me know and I will clarify as much as I can.  This is my first project using ASP and working with databases so I am completely learning as I go.  I took some database courses in college but I have never interacted with them with a web based front end.  Any help will be greatly appreciated.Thank you in advance for any time, help, and/or advice you can give.Brian 

View 5 Replies View Related

SQL Server 2012 :: Create Dynamic Update Statement Based On Return Values In Select Statement

Jan 9, 2015

Ok I have a query "SELECT ColumnNames FROM tbl1" let's say the values returned are "age,sex,race".

Now I want to be able to create an "update" statement like "UPATE tbl2 SET Col2 = age + sex + race" dynamically and execute this UPDATE statement. So, if the next select statement returns "age, sex, race, gender" then the script should create "UPDATE tbl2 SET Col2 = age + sex + race + gender" and execute it.

View 4 Replies View Related

Using Conditional Statement In Stored Prcodure To Build Select Statement

Jul 20, 2005

hiI need to write a stored procedure that takes input parameters,andaccording to these parameters the retrieved fields in a selectstatement are chosen.what i need to know is how to make the fields of the select statementconditional,taking in consideration that it is more than one fieldaddedfor exampleSQLStmt="select"if param1 thenSQLStmt=SQLStmt+ field1end ifif param2 thenSQLStmt=SQLStmt+ field2end if

View 2 Replies View Related

TSQL - Use ORDER BY Statement Without Insertin The Field Name Into The SELECT Statement

Oct 29, 2007

Hi guys,
I have the query below (running okay):



Code Block
SELECT DISTINCT Field01 AS 'Field01', Field02 AS 'Field02'
FROM myTables
WHERE Conditions are true
ORDER BY Field01

The results are just as I need:


Field01 Field02

------------- ----------------------

192473 8461760

192474 22810



Because other reasons. I need to modify that query to:



Code Block
SELECT DISTINCT Field01 AS 'Field01', Field02 AS 'Field02'
INTO AuxiliaryTable
FROM myTables
WHERE Conditions are true
ORDER BY Field01
SELECT DISTINCT [Field02] FROM AuxTable
The the results are:

Field02

----------------------

22810
8461760

And what I need is (without showing any other field):

Field02

----------------------

8461760
22810


Is there any good suggestion?
Thanks in advance for any help,
Aldo.

View 3 Replies View Related

DB Engine :: Can't Use The MERGE Statement / How To Design WHERE Condition For Insert Statement

Nov 5, 2015

I've have a need with SQL Server 2005 (so I've no MERGE statement), I have to merge 2 tables, the target table has 10 fields, the first 4 are the clustered index and primary key, the source table has the same fields and index.Since I can't use the MERGE statement (I'm in SQL 2005) I have to make a double step operation, and INSERT and an UPDATE, I can't figure how to design the WHERE condition for the insert statement.

View 2 Replies View Related

SQL Server 2012 :: Update Statement With CASE Statement?

Aug 13, 2014

i was tasked to created an UPDATE statement for 6 tables , i would like to update 4 columns within the 6 tables , they all contains the same column names. the table gets its information from the source table, however the data that is transferd to the 6 tables are sometimes incorrect , i need to write a UPDATE statement that will automatically correct the data. the Update statement should also contact a where clause

the columns are [No] , [Salesperson Code], [Country Code] and [Country Name]

i was thinking of doing

Update [tablename]
SET [No] =
CASE
WHEN [No] ='AF01' THEN 'Country Code' = 'ZA7' AND 'Country Name' = 'South Africa'
ELSE 'Null'
END

What is the best way to script this

View 1 Replies View Related

How To Write Select Statement Inside CASE Statement ?

Jul 4, 2006

Hello friends,
I want to use select statement in a CASE inside procedure.
can I do it? of yes then how can i do it ?

following part of the procedure clears my requirement.

SELECT E.EmployeeID,
CASE E.EmployeeType
WHEN 1 THEN
select * from Tbl1
WHEN 2 THEN
select * from Tbl2
WHEN 3 THEN
select * from Tbl3
END
FROM EMPLOYEE E

can any one help me in this?
please give me a sample query.

Thanks and Regards,
Kiran Suthar

View 7 Replies View Related

Transact SQL :: Update Statement In Select Case Statement

May 5, 2015

I am attempting to run update statements within a SELECT CASE statement.

Select case x.field
WHEN 'XXX' THEN
  UPDATE TABLE1
   SET TABLE1.FIELD2 = 1
  ELSE
   UPDATE TABLE2
   SET TABLE2.FIELD1 = 2
END
FROM OuterTable x

I get incorrect syntax near the keyword 'update'.

View 7 Replies View Related

Compiler Is Not Recognizing My Using Statement For SglConnection Statement

Feb 4, 2006

I am using ASP.NET 2.0, and am attempting to write some code to connect to the database and query a data table. The compiler is not recognizing my SqlConnection statement. It does recognize other commands. And just to make sure, I created other sql objects such as ObjectDataSource and SqlDataSource. The compiler does not find a problem with that code.
Basically the compiler is telling me that I am missing a "using" directive. The compiler is wrong though, because I am including the statement "usingSystemData" Can someone please take a look at my code below and to see if you notice what the problem might be?  Note that I numbered the lines of code below. Note that I also tried putting lines 3 trhough 6 before line 2(The page directive) but that did not fix the problem The compiler still gives me the same compiler message.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request.Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'SqlConnection' could not be found (are you missing a using directive or an assembly reference?)Source Error:
Line 21: SqlConnection sqlConn = new SqlConnection("server=localhost;uid=sa;pwd=password;database=master;");
1 <asp:sqldatasource runat="server"></asp:sqldatasource>
2 <%@ Page Language="C#"%>
3 using System;
4 using System.Data;
5 using System.Collections;
6 using System.Data.SqlClient;
7
8 <script runat=server>
9
10 protected void Page_Load(object o, EventArgs e)
11 {
12 ObjectDataSource dsa; // This works no problems from the compiler here
13 SqlDataSource ds; // This works no problems from the compiler
14
15 if (IsPostBack)
16 {
17 if (AuthenticateUser(txtUsername.Text,txtPassword.Text))
18 {
19 instructions.Text = "Congratulations, your authenticated!";
20 instructions.ForeColor = System.Drawing.Color.Red;
21 SqlConnection sqlConn = new SqlConnection("server=localhost;uid=sa;pwd=password;database=master;");
22 String sqlStmt = "Select UserName from LogIn where UserName='" + txtUsername.Text + "' and password='" + sHashedPassword + "'";
23 }
24 else
25 {
26 instructions.Text = "Please try again!";
27 instructions.ForeColor = System.Drawing.Color.Red;
28 }
29 }
30
31 }
32
33 bool AuthenticateUser(string username, string password)
34 {
35 // Authentication code goes here
36
37 }

View 1 Replies View Related

Case Statement Error In An Insert Statement

May 26, 2006

Hi All,
I've looked through the forum hoping I'm not the only one with this issue but alas, I have found nothing so I'm hoping someone out there will give me some assistance.
My problem is the case statement in my Insert Statement. My overall goal is to insert records from one table to another. But I need to be able to assign a specific value to the incoming data and thought the case statement would be the best way of doing it. I must be doing something wrong but I can't seem to see it.

Here is my code:
Insert into myTblA
(TblA_ID,
mycasefield =
case
when mycasefield = 1 then 99861
when mycasefield = 2 then 99862
when mycasefield = 3 then 99863
when mycasefield = 4 then 99864
when mycasefield = 5 then 99865
when mycasefield = 6 then 99866
when mycasefield = 7 then 99867
when mycasefield = 8 then 99868
when mycasefield = 9 then 99855
when mycasefield = 10 then 99839
end,
alt_min,
alt_max,
longitude,
latitude
(
Select MTB.LocationID
MTB.model_ID
MTB.elevation, --alt min
null, --alt max
MTB.longitude, --longitude
MTB.latitude --latitude
from MyTblB MTB
);

The error I'm getting is:
Incorrect syntax near '='.

I have tried various versions of the case statement based on examples I have found but nothing works.
I would greatly appreciate any assistance with this one. I've been smacking my head against the wall for awhile trying to find a solution.

View 10 Replies View Related







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