String Truncate Error
Jun 1, 2006
Yesterday my program was inserting and loading data in the database just fine, now when i try to do a myriad of things(make a paramatizsed search ad a favorites option) when ever i add data to the database i get a string trucate exception, basically its telling me the data im uploading is too large, problem is the feilds in the databse can take it.Its telling me the column im updating to has a string limit of 255 , but in reality the column its updating to has 2000 chracters available. Could some one please tell me how to fix this, it is quite urgent.
View 15 Replies
ADVERTISEMENT
May 15, 2008
Hi,
I am facing some issue in SQL 2005. There are five tables and tables having foreign check constrainst to child and parent relationship.
Now the issues is that i am able to delete the table in order wise and i am not able to truncate the all the tables in the same order.
Msg 4712, Level 16, State 1, Line 1
Cannot truncate table 'dbo.Tb_to_Markets' because it is being referenced by a FOREIGN KEY constraint.
But the same table i am delete it.
what can be cause for this error.
Thanks,
View 2 Replies
View Related
Jul 23, 2005
Greeting All, I have a stored proc that dynamically truncates all thetables in my databases. I use a cursor and some dynamic sql for this:......create cursorLoop through sysobjects and get all table names in my database.....exec ('truncate table ' + @TableName)Now, I want to be able to determine if an error occurred or not nad logthat error to a table in another database.However, when I try to trap the value of @@ERROR after theexec ('truncate table ' + @TableName) when an actual error occurs itfails. My error was synthetically created by placing a foreign key onthe table which precludes the option of truncation:Server: Msg 4712, Level 16, State 1, Line 1Cannot truncate table 'MyTable' because it is being referenced by aFOREIGN KEY constraint.The actual relevant code snippet is:BEGINBEGINSET @v_RowCount = (SELECT rowcntFROM sysindexesWHERE id = (SELECT idFROM sysobjectsWHERE name = @v_Name)AND indid IN (0,1))EXEC('truncate table ' + @v_Name)-- If there was an error truncating the current table.-- Write the event to the MessageLog table.IF (@@ERROR <> 0)BEGINSET @v_OutputMessage = ('There was an error ' + @v_name)INSERT INTO MessageLog (message) values (@v_outputmessage)RETURN (-1)ENDLike I was saying, when the error is generated because of the foreignkey the variable @@error is never set to 4712, in fact if I were to puta "select @@ERRROR" directly below the "exec('tru..')" statement itwould never be executed. The only thing that would show up inEnterprise Manager would be the:Server: Msg 4712, Level 16, State 1, Line 1Cannot truncate table 'MyTable' because it is being referenced by aFOREIGN KEY constraint.Any ideas as to what is going on here?Thanks, TFD.
View 3 Replies
View Related
Dec 30, 2004
With a database size of almost 2 GB, I run the 'truncate table eventlog command' which completes successfully, but the database size only decreases by about 10 MB so stays too large - indeed the number of rows in the eventlog table is minimal, but the otehr tables in this database don't show such an amount of tables large enough to cause the size issue either. What could be the reason and how can I reduce it (possibly truncating another table but then which one, how could I determine which is too large and needs truncating?).
View 3 Replies
View Related
Apr 17, 2008
Hi all...
Please forgive the elementary nature of my question, but could someone please explain the differences between these two database backup types:
1. Log backup
2. Log backup no truncate
From what I understand and have read, the "no truncate" backup method keeps the entire transaction log indefinitely. Using the truncation method, the transaction log is either 1) compressed or 2) cleaned up so that any completed transactions are removed from the log. Which one of these is true?
And, for the big question: is it better to run a backup of the transaction log with truncation or not? Our current backup scheme is similar to the following:
Full backup every 24 hours
transaction log backup every hour with no truncation
Should we insert a truncation backup somewhere in here? What is the danger of removing (or compressing) parts of the transaction log? Will this affect the restore process?
Thanks in advance!
View 6 Replies
View Related
Jul 12, 2007
Hi All,
i have migrated a DTS package wherein it consists of SQL task.
this has been migrated succesfully. but when i execute the package, i am getting the error with Excute SQL task which consists of Store Procedure excution.
But the SP can executed in the client server. can any body help in this regard.
Thanks in advance,
Anand
View 4 Replies
View Related
May 24, 2007
Hi All...
I am trying to move my site (incomplete) for testing and I am finding that the Db connection process to be
the most difficult, well back to my problem. I can't seem to get past this error and am frustrated with overall
connectivity problems. Please help!!!
===================================================================================
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
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: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735123
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +130
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84
System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197
System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160
System.Web.UI.WebControls.Login.AttemptLogin() +105
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
Now you all must admit that, if your somewhat new to this databasing, It's a ***.
The source for my application is Visual Web Designer 2005 Express
It is an ASP.Net driven site with membership roles and all the good stuff.
the latest theory is that I need to change the provider config in the web.config file from AspNetSqlProvider
to something else. Most of my complications and frustrations come from GoDaddy and no access to the
shared server (understandibly).
I hope I gave enough info for help and not too much..
Dave
View 4 Replies
View Related
Feb 12, 2005
I am trying to create a page that adds users to a MS SQL database. In doing so, I have run into a couple errors that I can't seem to get past. I am hoping that I could get some assistance with them.
Error from SQL Debug:
---
Server: Msg 295, Level 16, State 3, Procedure AdminAddUser, Line 65
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting character string to smalldatetime data type.
---
Error from page execution:
---
Exception Details: System.Data.OleDb.OleDbException: Error converting data type varchar to numeric.
Source Error:
Line 77: cmd.Parameters.Add( "@zip", OleDbType.VarChar, 100 ).Value = Request.Form("userZip")
Line 78:
Line 79: cmd.ExecuteNonQuery()
---
Below is what I currently have for my stored procedure and the pertinent code from the page itself.
Stored Procedure:
---
CREATE PROCEDURE dbo.AdminAddUser( @username varchar(100),
@password varchar(100),
@email varchar(100),
@acct_type varchar(100),
@realname varchar(100),
@billname varchar(100),
@addr1 varchar(100),
@addr2 varchar(100),
@city varchar(100),
@state varchar(100),
@country varchar(100),
@zip varchar(100),
@memo varchar(100) )
AS
BEGIN TRAN
--
-- Returns 1 if successful
-- 2 if username already exists
-- 0 if there was an error adding the user
--
SET NOCOUNT ON
DECLARE @error int, @rowcount int
--
-- Make sure that there isn't already a user with this username
--
SELECT userID
FROM users
WHERE username=@username
SELECT @error = @@ERROR, @rowcount = @@ROWCOUNT
IF @error <> 0 OR @rowcount > 0 BEGIN
ROLLBACK TRAN
RETURN 2
END
--
-- Set expiration date
--
DECLARE @expDate AS smalldatetime
IF @acct_type = "new_1yr" BEGIN
SET @expDate = DATEADD( yyyy, 1, GETDATE() )
END
IF @acct_type = "new_life" BEGIN
SET @expDate = DATEADD( yyyy, 40, GETDATE() )
END
DECLARE @paidCopies AS decimal
SET @paidCopies = 5
--
-- Add this user to the database
--
IF @acct_type <> "new" BEGIN
INSERT INTO users (userName, userPassword, userEmail, userJoinDate,
userPaidCopies, userExpirationDate, userLastPaidDate,
userBname, userRealName, userAddr1, userAddr2, userCity,
userState, userCountry, userZip, userMemo )
VALUES (@username, @password, @email, GETDATE(), @realname, @billname,
@paidCopies, @expDate, GETDATE(), @addr1, @addr2, @city, @state, @country, @zip, @memo )
SELECT @error = @@ERROR, @rowcount = @@ROWCOUNT
IF @error <> 0 OR @rowcount < 1 BEGIN
ROLLBACK TRAN
RETURN 0
END
END
IF @acct_type = "new" BEGIN
INSERT INTO users (userName, userPassword, userEmail, userJoinDate,
userBname, userRealName, userAddr1, userAddr2, userCity,
userState, userCountry, userZip, userMemo )
VALUES (@username, @password, @email, GETDATE(), @realname, @billname,
@addr1, @addr2, @city, @state, @country, @zip, @memo )
SELECT @error = @@ERROR, @rowcount = @@ROWCOUNT
IF @error <> 0 OR @rowcount < 1 BEGIN
ROLLBACK TRAN
RETURN 0
END
END
COMMIT TRAN
RETURN 1
GO
---
Page Code:
---
Sub AddUser(Sender as Object, e as EventArgs)
Dim db_conn_str As String
Dim db_conn As OleDbConnection
Dim resultAs Int32
Dim cmdAs OleDbCommand
db_conn_str = "Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=xxxxx; User ID=xxxxx; PWD=xxxxx;"
db_conn = New OleDbConnection( db_conn_str )
db_conn.Open()
cmd = new OleDbCommand( "AdminAddUser", db_conn )
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add( "result", OleDbType.Integer ).Direction = ParameterDirection.ReturnValue
cmd.Parameters.Add( "@username", OleDbType.VarChar, 100 ).Value = Request.Form("userName")
cmd.Parameters.Add( "@password", OleDbType.VarChar, 100 ).Value = Request.Form("userPass")
cmd.Parameters.Add( "@email", OleDbType.VarChar, 100 ).Value = Request.Form("userEmail")
cmd.Parameters.Add( "@acct_type", OleDbType.VarChar, 100 ).Value = Request.Form("userEmail")
cmd.Parameters.Add( "@realname", OleDbType.VarChar, 100 ).Value = Request.Form("userRealName")
cmd.Parameters.Add( "@billname", OleDbType.VarChar, 100 ).Value = Request.Form("userBname")
cmd.Parameters.Add( "@addr1", OleDbType.VarChar, 100 ).Value = Request.Form("userAddr1")
cmd.Parameters.Add( "@addr2", OleDbType.VarChar, 100 ).Value = Request.Form("userAddr2")
cmd.Parameters.Add( "@city", OleDbType.VarChar, 100 ).Value = Request.Form("userCity")
cmd.Parameters.Add( "@state", OleDbType.VarChar, 100 ).Value = Request.Form("userState")
cmd.Parameters.Add( "@country", OleDbType.VarChar, 100 ).Value = Request.Form("userCountry")
cmd.Parameters.Add( "@memo", OleDbType.VarChar, 100 ).Value = Request.Form("userMemo")
cmd.Parameters.Add( "@zip", OleDbType.VarChar, 100 ).Value = Request.Form("userZip")
cmd.ExecuteNonQuery()
(...)
---
View 1 Replies
View Related
Jan 17, 2007
here is my code the falue of pr_h_reqby is "Test"
Dim strconn As New SqlConnection(connstring)
Dim myReqdata As New DataSet
Dim mycommand As SqlDataAdapter
Dim sqlstr As String = "select pr_H_reqby from tbl_pr_header where pr_h_recid = " & recid & ""
mycommand = New SqlDataAdapter(sqlstr, strconn)
mycommand.Fill(myReqdata, "mydata")
If myReqdata.Tables(0).Rows.Count > 0 Then
'lblReqID.Text = myReqdata.Tables(0).Rows("reqid").ToString
lblNameVal.Text = myReqdata.Tables("mydata").Rows("pr_H_reqby").ToString()
lblEmailVal.Text = myReqdata.Tables("mydata").Rows("pr_h_reqemail").ToString()
lblReqDateVal.Text = myReqdata.Tables("mydata").Rows("pr_h_reqdate").ToString()
lblneedval.Text = myReqdata.Tables("mydata").Rows("pr_h_needdt").ToString()
lblDeptval.Text = myReqdata.Tables("mydata").Rows("pr_h_dept").ToString()
txtbxReqDesc.Text = myReqdata.Tables("mydata").Rows("pr_h_projdesc").ToString()
End If
View 1 Replies
View Related
May 5, 2003
Hi everybody,
I do custom log shipping over network like
step 1 backup log to C:..
step 2 zip log file c:... zip
step 3 copy zip to \sm01
estorelogs...
step 4 unzip file
step 5 restore log with stand by
Few times a month it fails with
Error = -2147467259 (80004005) Error string: Timeout expired Error source: Microsoft OLE DB Provider for SQL Server Help file: Help context: 0 Error Detail Records: Error: -2147467259 (80004005); Provider Error: 0 (0) Error string: Timeout expired Error source: Microsoft OLE DB Provider for SQL Server
Any idea ,what might cause it ?
Thank you
Alex
View 3 Replies
View Related
Jan 7, 2004
Hi All, can someone help me,
i've created a stored procedure to make a report by calling it from a website.
I get the message error "241: Syntax error converting datetime from character string" all the time, i tryed some converting things but nothig works, probably it is me that isn't working but i hope someone can help me.
The code i use is:
CREATE proc CP_Cashbox @mID varchar,@startdate datetime,@enddate datetime
as
set dateformat dmy
go
declare @startdate as varchar
declare @enddate as varchar
--print "query aan het uitvoeren"
select sum(moneyout) / sum(moneyin)*100 as cashbox
from dbo.total
where machineID = '@mID' and njdate between '@startdate' and '@enddate'
GO
Thanx in front
Cya
View 14 Replies
View Related
Nov 28, 2001
HELP! im running this sql and get the following error - If i manually start the dts package it is fine....also if i use DTSrun from my pc it also works ok..
USE master
EXEC xp_cmdshell 'DTSrun /S BTN_AH_TWB02NEW /U pkent /P clarke05 /N pbk'
output
DTSRun: Loading...
Error: -2147024809 (80070057); Provider Error: 0 (0)
Error string: The parameter is incorrect.
Error source: Microsoft Data Transformation Services (DTS) Package
Help file: sqldts.hlp
Help context: 713
(9 row(s) affected)
View 2 Replies
View Related
Apr 25, 2007
I didn't find a good thread to put this, but since I noticed it in the SQL Server Express version I put it here:
Here is an error I get in Swedish:
"Konvertering av nvarchar värdet av typen Ny! till datatypen int misslyckades."
The error string is however not correct. In English it reads:
Syntax error converting the nvarchar value 'Ny!' to a column of data type int.
And in Swedish it should be:
"Konvertering av nvarchar-värdet 'Ny!' till datatypen int misslyckades."
or even
"Konvertering av nvarchar-värdet 'Ny!' till ett fält av datatypen int misslyckades."
Is there an address to send this kind of errors to?
Kind regards,
Andreas Jansson
View 3 Replies
View Related
Oct 23, 2007
I have an ExecuteSQL task that uses a variable as an input. The variable is made up of several other variables concatenated together. It was working fine but I changed the name of one of the "other" variables and now it does not work.
I get this error:
Type of variable "VariableName" is not a string.
The "Evaluate Expression" of the variable works fine and the "Parse Query" in the "Execute SQL Task Editor" says the query parses correctly.
I changed the name of the variable by adding a "1" to the end of it.
What is wrong?
Fred
View 6 Replies
View Related
Aug 15, 2006
Hello I need some help please.
I created a connection string in my web config. I then tried to call it in one of my c# pages but I get a "System.InvalidOperationException: Instance failure" every time I run it.
Please review my code and let me know what I am doing wrong.
Thank you in advance for all the help
Web Config
<appSettings>
<add key="AVConnection" value="Server=Server; Database=DB; User ID=sa; Password=PWD" />
</appSettings>
//////calling connection and running a simple SQL statment///////
protected void Page_Load(object sender, EventArgs e)
{
string ConnApp;
ConnApp = System.Configuration.ConfigurationManager.AppSettings["AVConnection"];
Response.Write(ConnApp);//the string is being passed this far
SqlConnection objConn = new SqlConnection(ConnApp);
SqlCommand sqlCMD = new SqlCommand("Select * FROM Employee", objConn);
objConn.Open();//this is where the error occures
SqlDataReader objRdr = sqlCMD.ExecuteReader();
Repeater1.DataSource = objRdr;
Repeater1.DataBind();
objConn.Close();
objRdr.Close();
}
ERROR PAGE
Line 29: SqlCommand sqlCMD = new SqlCommand("Select * FROM Employee", objConn);Line 30: Line 31: objConn.Open();Line 32: SqlDataReader objRdr = sqlCMD.ExecuteReader();Line 33: Repeater1.DataSource = objRdr;
[InvalidOperationException: Instance failure.] System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +683775 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 employeelist.Page_Load(Object sender, EventArgs e) in c:InetpubwwwrootFAUAVemployeelist.aspx.cs:31 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
View 2 Replies
View Related
Dec 16, 2007
Just installed AJAX for VS2005 and started to build a AJAX enabled web site. I got the following message after creating a database (SQL) and Dataset "FOLLOWING ERROR OCCURED WHLE GETTING CONNECTION STRING INFORMATION FROM CONFIGURATION:'CANNOT GET WEB APPLICATION SERVICE'.
I didn't have this problem before,can it be related to AJAX?
Thank you in advance,
View 1 Replies
View Related
Jan 29, 2008
Hi, I'm very new to SQL server so please excuse. Basically I'm trying to connect 6 text boxes on my web form to my sql database using c#. The following lines of code behind my save button pops up with this error. "NullRefernrenceException was unhandled by user code - Object reference not set to an instance of an object". I think its something small but as I said I'm only new so I dont have much of a clue. protected void btnSave_Click(object sender, EventArgs e) { String strConn = ConfigurationManager.ConnectionStrings["conLocalDatabase"].ConnectionString; SqlConnection dbConnection = new SqlConnection(strConn); SqlCommand dbCommand = new SqlCommand(); SqlDataReader dbReader Any help would be much obliged.
View 10 Replies
View Related
May 2, 2008
hi, i am facing a problem:"An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance
Specified)"my web config code is <connectionStrings> <add name="ConnectionString" connectionString="Data Source=.kindleinfotech.com;AttachDbFilename=|DataDirectory|database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /> </connectionStrings>here kindleinfotech.com is the name of server.how this problem can be solved.
View 12 Replies
View Related
Jun 12, 2008
Hello all
First Problem:
I tried to get the connection string from web.config using Configuration manager
-------------code------------------
ConfigurationManager.AppSettings("MyProBD");
-------------code------------------
the below error was occurred
-------------Error------------------
Error 1 The name 'ConfigurationManager' does not exist in the current context-------------Error------------------
Second Problem
when declare connection string in the code
-------------code------------------string strConnection = "Data Source=(local); Initial Catalog=MyProDB; Integrated Security=SSPI;";
con.ConnectionString = strConnection;
-------------code------------------
the below error was occurred
-------------Error------------------
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
-------------Error------------------
any help Please
View 7 Replies
View Related
Jun 5, 2007
<add name="TimeTrackingDB" connectionString="provider=MSSQL$DEV_2000;Integrated Security=SSPI;Data Source=PORT06139DEV_2000;Initial Catalog=TimeTracking;Persist Security Info=True;User ID=user_TTT;Password=user_TTT;pooling=false;"/>
When i'm lauching the web application, i have an error message saying that there is a mistake with the provider...
I'm using Microsoft SQL Server 2000.
Anybody can help me?
Thanks by advance :)
View 2 Replies
View Related
Jul 20, 2005
I am trying to create a job that, as one of its steps, will kick off aDTS package. As part of the command parameter, I need to concat asystem variable (@@SERVERNAME) to a constant string. I am receiving anerror about incorrect syntax near the +.Here is the code for the job step.-- Add the job stepsEXECUTE @ReturnCode = msdb.dbo.sp_add_jobstep@job_id = @JobID,@step_id = 1,@step_name = N'Import OCC Series Data',@command = N'DTSRun /FD:DatabasesScriptsDTSImportOCCSeriesData.dts /A DbName:8=' +@@SERVERNAME,@database_name = N'',@server = N'',@database_user_name = N'',@subsystem = N'CmdExec',@cmdexec_success_code = 0,@flags = 2,@retry_attempts = 0,@retry_interval = 1,@output_file_name = N'',@on_success_step_id = 0,@on_success_action = 3,@on_fail_step_id = 0,@on_fail_action = 3IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollbackIf I just try SELECT N'DTSRun /FD:DatabasesScriptsDTSImportOCCSeriesData.dts /A DbName:8=' +@@SERVERNAME, everything works fine. I even tried declaring a localvariable named @command and setting it in the select statement, but nodice.
View 2 Replies
View Related
Sep 7, 2007
Hi,
I have some columns that can be either a Number or Text.
and I have to sum all the value if that column is a Number, therefore in my Table footer i have:
=IIF(IsNumeric(Fields!Col1.Value),Sum(Fields!Col1.Value),"")
However this will give me #ERROR if the columns is Text. It works for Number.
Any help is appreciated, thanks
Jon
View 7 Replies
View Related
Jan 3, 2007
I'm creating my first SSIS package. The data source is a csv file and the destination is a SQL server table. I have several lookups. The date and time lookups are working fine. The string lookups are failing. I can see the records when I open the table in SQL Server. Do I need special handling for strings? Truncating?
Here are the error messages. I'd appreciate any input and help. Thanks.
[Lookup Commodity [2560]] Error: Row yielded no match during lookup.
[Lookup Commodity [2560]] Error: The "component "Lookup Commodity" (2560)" failed because error code 0xC020901E occurred, and the error row disposition on "output "Lookup Output" (2562)" specifies failure on error. An error occurred on the specified object of the specified component.
[DTS.Pipeline] Error: The ProcessInput method on component "Lookup Commodity" (2560) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.
[DTS.Pipeline] Error: Thread "WorkThread0" has exited with error code 0xC0209029.
View 5 Replies
View Related
Mar 11, 2008
Help - this is the error I am getting:
[IBM][Client access ODBC Driver (32-bit)] string length exceeds column length parameter #1. Data truncated. (#0).
Any idea how to fix this?
It is a select query in Access, which is pulling data from a SQL Server. It works with no criteria, but as soon as criteria is put into one of the fields, it blows up.
Thanks!
View 3 Replies
View Related
Feb 5, 2007
OK - I have seen lots posted on this, but the behavior is very strange, and I am trying to understand:
I am using Visual Basic 2003 with SQLEXPRESS 2005 to connect to a database and to develop a desktop application. My connection string is:
Conn_Str = "Data Source=.SQLExpress;AttachDbFilename=" & _
Directory.GetCurrentDirectory & "CWW.mdf;" & _
"Trusted_Connection=Yes;"
I get the following error:
"An attempt to attach an auto-named database for file C:Documents and SettingsBrianMy DocumentsCompressor Program DevelopmentinCWW.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
However, if I copy the database to anywhere else on the "c:" drive, the connection works, as in the following:
Conn_Str = "Data Source=.SQLExpress;AttachDbFilename=" & _
"C: empCWW.mdf;" & _
"Trusted_Connection=Yes;"
What I have found is that ist works everywhere on my computer except in the following location:
"c:documents and settingsBrian", which includes My Documents, Desktop folders.
Why is this??
Any help would be great - I can work around this by moving my development folder to the "c:" drive. Since my ultimate application directory will be the "Program Files" directory I should be fine.
View 5 Replies
View Related
Jul 25, 2006
I have been having a problem trying to connect to a SQL Server. I have installed the Developer edition on an MS Small Business edition 2003 server
I also installed MS Sql Manager and I was able to create a database and connect to it. The database server is in the same PC. I used the surface configuration to enable remote connections using TCP /IP and pipe lines.
My application runs without a problem on my development machine but when I deployed on this server I get the provider: SQL Network Interfaces, error: 25 - Connection string is not valid Error.
this is my config file setup
<connectionStrings> <add name="Diamond_dbConnectionString" connectionString="Data Source=192.168.1.104MSSQLSERVER;Initial Catalog=Diamond_db;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings>
I have google and yahoo this error I found a lot of information I've tried many of them but still having the problem. I will appreciate your help solving this problem. I have a customer waiting since last week to see this site and I'm still stuck.
Tia
Charles
PS. Below I pasted the complete error info I get.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid) 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: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[SqlException (0x80131904): An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734995
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +107
DiamondTableAdapters.COUNTRIES_TEMPLATETableAdapter.GetContriesTemplate() +108
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +296
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +482
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2040
System.Web.UI.WebControls.BaseDataList.GetData() +53
System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +284
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +56
System.Web.UI.WebControls.BaseDataList.DataBind() +72
System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +55
System.Web.UI.WebControls.BaseDataList.CreateChildControls() +63
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
View 6 Replies
View Related
Feb 2, 2007
I have installed SQL Server 2005 Developer edition. When I open SQL Server Management Studio, and try to connect to the database engine, I enter these credentials:Server name: LT2000MSSQLSERVERLogin: saPassword: my passwordWhen I try to connect I receive the following error:An error has occured while trying to establish a connection to the server. When connecting to SQL server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.(provider: sql network interfaces, error:25 - connection string is not valid)(Microsoft SQL Server, Error:87)What can I do?
View 5 Replies
View Related
Feb 20, 2007
I can not get this query to work can some on help me?
SELECT count(JOBID) AS 'transcount', count(distinct patientid) AS 'patient count', sum(TRANSPORTATION_TCOST) AS 'tcost,sum(TRANSPORTATION_DISC_COST) as ' dtcost ',avg(TRANSPORTATION_DISC) as "avgTDisc",(sum(transportation_tcost) + sum(TRANSPORTATION_DISC_COST)) as "TGrossAMTBilled', (sum(transportation_tcost) / count(DISTINCT patientid)) AS 'PatAvgT', sum(TRANSPORTATION_DISC) AS 'avgPercentDiscT' job.JURSDICTIONFROM job LEFT JOIN payer ON payer.payerid = job.payerid LEFT JOIN states ON job.jurisdiction = states.initialsWHERE (job.transportation = '1') AND ((job.datedcreated = @startdate) AND (job.datecreated = @enddate)) AND states.region = 'GA'GROUP BY job.JURISDICTIONORDER BY PatAvgT DESC
View 2 Replies
View Related
Aug 27, 2007
hi all, i'm retreiving user input using textboxes and saving to a gridview. i'm getting this error and i dont know whats causing it. <asp:SqlDataSource ID="SqlDataSource1" runat="server"
InsertCommand="INSERT INTO test101(Surname,Names,Regno)VALUES (@Surname, @Names, @Regno)"ConnectionString="<%$ ConnectionStrings:engineeringConnectionString %>" ProviderName=System.Data.SqlClient
ConflictDetection="CompareAllValues" >
<InsertParameters>
<asp:ControlParameter ControlID="TextBox1" DefaultValue="TextBox1.Text" Name="Surname"
PropertyName="Text" Size="50" Type=Char />
<asp:ControlParameter ControlID="TextBox2" DefaultValue="TextBox2.Text" Name="Names"
PropertyName="Text" Size="50" Type=Char />
<asp:Parameter DefaultValue="TextBox3.Text" Name="Regno" />
</InsertParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1"
runat="server" AutoGenerateColumns="False" AutoGenerateDeleteButton="True" DataKeyNames="ID"AutoGenerateEditButton="True" AllowSorting="True" BackColor="LightGoldenrodYellow"
BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" PageSize="20"
Height="374px" EmptyDataText="null" DataSourceID=SqlDataSource1 Visible="False" >
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
SortExpression="ID" />
<asp:BoundField DataField="Surname" HeaderText="Surname" SortExpression="Surname" />
<asp:BoundField DataField="Names" HeaderText="Names" SortExpression="Names" />
<asp:BoundField DataField="Registration" HeaderText="Registration" SortExpression="Registration" />
<asp:BoundField DataField="Grade" HeaderText="Grade" SortExpression="Grade" />
</Columns>
</asp:GridView>
and the code behind is:protected void Page_Load(object sender, EventArgs e)
{SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=engineering; Integrated Security=True");
conn.Open();
GridView1.DataBind();
conn.Close();
}
public void login1_Click(object sender, EventArgs e)
{
SqlDataSource1.Insert();
Response.Write("you have successfully being added to the database");
can anyone help?!!!
View 1 Replies
View Related
May 12, 2008
Hello All, i am trying to connect to SQL Database using OleDb connection, but i keep getting error. here is my connection code. string strCon = "Provider=SQLOLEDB.1;Data source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"; OleDbConnection con = null; OleDbCommand cmd = null; con = new OleDbConnection(strCon); con.Open(); // deleting the exisitng one//
cmd = con.CreateCommand();
cmd.CommandText = "DELETE FROM Detail"; cmd.ExecuteNonQuery(); con.Close(); con.Dispose(); con = null;this is the error i am getting ..........No error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21). 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.OleDb.OleDbException: No error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21).Source Error:
Line 43: OleDbCommand cmd = null;Line 44: con = new OleDbConnection(strCon);Line 45: con.Open();Line 46: // deleting the exisitng one//Line 47: cmd = con.CreateCommand(); can some please tell me where i am making the mistake. I really appreciate it.Thanks
View 4 Replies
View Related
Jun 6, 2008
I have a dropdown list thats boudn to a SqlDataSource. The DataSource looks like this:
<asp:SqlDataSource ID="dsProgramList" runat="server" ConnectionString="<%$ ConnectionStrings:csData %>"
SelectCommand="SELECT DISTINCT [Program_Name] +','+ [Begin_Date] AS NAMEandDATE, [Course_ID], [LOC] FROM [ThisTable] WHERE ([LOC] = @LOC)">
<SelectParameters>
Where the dropdownlists text = NAMEandDATE and its value = Course_ID
When I select the LOC from the LOCdropdownlist, the dropdownlist in question updates, and an error "Erro converting datetime from character string" happens?
Any suggestions?
View 4 Replies
View Related
Jan 5, 2005
Hi;
Installed MSDE on computer by running:
c:setup INSTANCENAME="VSdotNET" SAPWD="PASSWORD" SECURITYMODE=SQL
REBOOTED AND sql SERVER iCON APPEARS on the lower desktop Icon bar, open it and it says:
Server: JOHN Servises: SQL Server Running \JOHN - MSSQLServer
opened a command prompt at c: and
entered osql -S JOHN -U sa -P password
and got the 1> reply on the next line
I typed EXIT
I had downloaded two scripts that create Pubs and Northwind SQL databases. I put them in the C: folder
I Typed at c:osql -E -i instpubs.sql
It created the pubs SQL database for me
I Typed at c:osql -E -i instnwinds.sql
It created the nwinds SQL database for me
I closed the command prompt and
went to the Administrator Tools in the Control Panel
I selected Data OLEDB Selected ADD entered Pubs and used default values for Pubs to create a connection Tested it OK
Then went and ran Visual Studio Net 2003
Checked to see if the pubs and northwind SQL databases where present in the Server Explorer drop down window.
I seleced the connect to database Icon and in it's Data Link Properties
I entered JOHN for server name
pubs for selected database on the server
with Provider as MS OLEDB for SQL Service
the Icon changed to connected.
I entered this in the code for page_load
Dim MyDS As New DataSet
Dim ConnStr As String
Dim SQL As String
ConnStr = "server=(local)C:Program FilesMicrosoft SQL ServerMSSQLData;database=pubs;Trusted_Connection=yes"
SQL = "SELECT * FROM Titles " & _
"SELECT * FROM Publishers"
Dim MySqlConn As New SqlConnection(ConnStr)
Dim MySqlAdapter As New SqlDataAdapter(SQL, ConnStr)
'The SqlDataAdapter will automatically open and
'close the SqlConnection
MySqlAdapter.Fill(MyDS)
But I can not get this to work it errors out on line:
MySQLAdapter.Fill(myDS)
with: [SqlException (0x80131904): Unknown ProviderError Locating Server/Instance Specified ]
System.Data.ProviderBase.DbConnectionPool.GetConnection(Object owningObject) +317
I change ConnStr to this:
ConnStr = "server=(local)data;database=pubs; uid=sa; Pwd=password" & _
"Trusted_Connection=true"
and get this error:
[SqlException (0x80131904): Shared Memory Provider: The system cannot find the file specified.
]
System.Data.ProviderBase.DbConnectionPool.GetConnection(Object owningObject) +317
I've tried so many combination with and without user and password, I just don't get it, spent three long days stuck here, can someone help me out.
Note:
C:Program FilesMicrosoft SQL ServerMSSQLData
Is the accual location on my machine that pubs database is located.
I can use the pubs SQL database in Web Matrix OK.
Thanks
pdqjohnny@hotmail.com
View 2 Replies
View Related
Apr 14, 2005
Hi all,
Complete newbie to ASP.NET, but you have to learn some time. Anyway, I am attempting to fill a datagrid from the Northwind database installed on my SQL server at work and I receive the following error when I attempt to compile to check the connection.
Format of the initialization string does not conform to specification starting at index 67.
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.ArgumentException: Format of the initialization string does not conform to specification starting at index 67.Source Error:
Line 31:
Line 32: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Line 33: Dim cnn As New SqlConnection( _
Line 34: "Data source=xxxxx;Initial Catalog=Northwind;User ID=sa;Password=;xxxxxx")
Line 35: End SubSource File: C:InetpubwwwrootApp_02default.aspx.vb Line: 33 Stack Trace:
[ArgumentException: Format of the initialization string does not conform to specification starting at index 67.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, String& keyname, String& keyvalue) +1203
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +127
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useFirstKeyValuePair) +103
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +32
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +25
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolOptions poolOptions, DbConnectionOptions& userConnectionOptions) +119
System.Data.ProviderBase.DbConnectionBase.set_ConnectionString(String value) +53
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +7
System.Data.SqlClient.SqlConnection..ctor(String connectionString) +23
App_02.WebForm1.Page_Load(Object sender, EventArgs e) in C:InetpubwwwrootApp_02default.aspx.vb:33
System.Web.UI.Control.OnLoad(EventArgs e) +102
System.Web.UI.Control.LoadRecursive() +45
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +952
I have been tearing my hair out trying to work out this error. Can anyone help????
Using VisualStudio.NET 2003 on an XP box and and SQL Server 2000 on a Windows2003 Server box.
Thanks,
Gerald
View 1 Replies
View Related