Very Strange SQL INSERT Command Error.

Jun 4, 2007

"INSERT INTO tblEquip(buydate,Country,feature,pc,Provider,Serial,Status,Warranty,Year,Typeid ) VALUES ('12/12/2008','Viet Nam','Supper Power ',0,'IBM','ABCDEF','Out of warranty','12/12/2008',1965,5);"



I use Visual 2005 IDE and code in C# , with an MS Access 2003 Databse.

Above SQL command is gotten from Debug.

It works well when i paste into a query in MS Access 2003.

But in my project, it return an error : Syntax error in INSERT INTO statement when I use a try catch statement.



Where is my wrong ? Please help me.Thanks!

View 3 Replies


ADVERTISEMENT

Strange T-SQL Error On A Command...

Oct 19, 2007

I have two SQL servers onr is staging (SQL2005) the other is production (SQL2000). I have a primary key with constraints on a table and I script out the Create for the primary key with constraints. I run the generated T-SQL script on the staging (SQL2005) and it works great. No probs so far. Now I cut and paste the same generate T-SQL script into my production (SQL2000) server and I get this error...

Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '('.

Now this is the same exact cut/paste of the script that ran perfectly fine on my SQL2005 server. So I copied it agan from production (SQL2000) and pasted it into staging (SQL2005) and it works.

Here's the script...
USE [TEST]
GO
ALTER TABLE [dbo].[fovecComments] ADD CONSTRAINT [PK_fovecContacts] PRIMARY KEY CLUSTERED
([iUserId] ASC) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

Any ideas?

View 1 Replies View Related

Displaying Error When Using Insert Command

Jan 27, 2006

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:intranetnewConnectionString %>"
InsertCommand="INSERT INTO timeoffcalc(Typeoftime, amountoftime, employeeID) VALUES (@TypeofTime, @Amountoftime, @emplID)"
 
 
I have the emplyID and Typeof time as a PK. When the user enters a duplicate value it just gives them the error page. Can i set a label or something to notify the user of the error instead of the error page?

View 5 Replies View Related

Strange Problem: SQL Insert Statement Does Not Insert All The Fields Into Table From Asp.net C# Webpage

Apr 21, 2008

An insert statement was not inserting all the data into a table. Found it very strange as the other fields in the row were inserted. I ran SQL profiler and found that sql statement had all the fields in the insert statement but some of the fields were not inserted. Below is the sql statement which is created dyanmically by a asp.net C# class. The columns which are not inserted are 'totaltax' and 'totalamount' ...while the 'shipto_name' etc...were inserted.there were not errors thrown. The sql from the code cannot be shown here as it is dynamically built referencing C# class files.It works fine on another test database which uses the same dlls. The only difference i found was the difference in date formats..@totalamount=1625.62,@totaltax=125.62are not inserted into the database.Below is the statement copied from SQL profiler.exec sp_executesql N'INSERT INTO salesorder(billto_city, billto_country, billto_line1, billto_line2, billto_name,billto_postalcode, billto_stateorprovince, billto_telephone, contactid, CreatedOn, customerid, customeridtype,DeletionStateCode, discountamount, discountpercentage, ModifiedOn, name, ordernumber,pricelevelid, salesorderId, shipto_city, shipto_country,shipto_line1, shipto_line2, shipto_name, shipto_postalcode, shipto_stateorprovince,shipto_telephone, StateCode, submitdate, totalamount,totallineitemamount, totaltax ) VALUES(@billto_city, @billto_country, @billto_line1, @billto_line2,@billto_name, @billto_postalcode, @billto_stateorprovince, @billto_telephone, @contactid, @CreatedOn, @customerid,@customeridtype, @DeletionStateCode, @discountamount,@discountpercentage, @ModifiedOn, @name, @ordernumber, @pricelevelid, @salesorderId,@shipto_city, @shipto_country, @shipto_line1, @shipto_line2,@shipto_name, @shipto_postalcode, @shipto_stateorprovince, @shipto_telephone,@StateCode, @submitdate, @totalamount, @totallineitemamount, @totaltax)',N'@billto_city nvarchar(8),@billto_country nvarchar(13),@billto_line1 nvarchar(3),@billto_line2 nvarchar(4),@billto_name nvarchar(15),@billto_postalcode nvarchar(5),@billto_stateorprovince nvarchar(8),@billto_telephone nvarchar(3),@contactid uniqueidentifier,@CreatedOn datetime,@customerid uniqueidentifier,@customeridtype int,@DeletionStateCode int,@discountamount decimal(1,0),@discountpercentage decimal(1,0),@ModifiedOn datetime,@name nvarchar(33),@ordernumber nvarchar(18),@pricelevelid uniqueidentifier,@salesorderId uniqueidentifier,@shipto_city nvarchar(8),@shipto_country nvarchar(13),@shipto_line1 nvarchar(3),@shipto_line2 nvarchar(4),@shipto_name nvarchar(15),@shipto_postalcode nvarchar(5),@shipto_stateorprovince nvarchar(8),@shipto_telephone nvarchar(3),@StateCode int,@submitdate datetime,@totalamount decimal(6,2),@totallineitemamount decimal(6,2),@totaltax decimal(5,2)',@billto_city=N'New York',@billto_country=N'United States',@billto_line1=N'454',@billto_line2=N'Road',@billto_name=N'Hillary Clinton',@billto_postalcode=N'10001',@billto_stateorprovince=N'New York',@billto_telephone=N'124',@contactid='8DAFE298-3A25-42EE-B208-0B79DE653B61',@CreatedOn=''2008-04-18 13:37:12:013'',@customerid='8DAFE298-3A25-42EE-B208-0B79DE653B61',@customeridtype=2,@DeletionStateCode=0,@discountamount=0,@discountpercentage=0,@ModifiedOn=''2008-04-18 13:37:12:013'',@name=N'E-Commerce Order (Before billing)',@ordernumber=N'BRKV-CC-OKRW5764YS',@pricelevelid='B74DB28B-AA8F-DC11-B289-000423B63B71',@salesorderId='9CD0E11A-5A6D-4584-BC3E-4292EBA6ED24',@shipto_city=N'New York',@shipto_country=N'United States',@shipto_line1=N'454',@shipto_line2=N'Road',@shipto_name=N'Hillary Clinton',@shipto_postalcode=N'10001',@shipto_stateorprovince=N'New York',@shipto_telephone=N'124',@StateCode=0,@submitdate=''2008-04-18 14:37:10:140'',@totalamount=1625.62,@totallineitemamount=1500.00,@totaltax=125.62
 
thanks

View 7 Replies View Related

Defining Command,commandtype And Connectionstring For SELECT Command Is Not Similar To INSERT And UPDATE

Feb 23, 2007

i am using visual web developer 2005 and SQL 2005 with VB as the code behindi am using INSERT command like this        Dim test As New SqlDataSource()        test.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString1").ToString()        test.InsertCommandType = SqlDataSourceCommandType.Text        test.InsertCommand = "INSERT INTO try (roll,name, age, email) VALUES (@roll,@name, @age, @email) "                  test.InsertParameters.Add("roll", TextBox1.Text)        test.InsertParameters.Add("name", TextBox2.Text)        test.InsertParameters.Add("age", TextBox3.Text)        test.InsertParameters.Add("email", TextBox4.Text)        test.Insert() i am using UPDATE command like this        Dim test As New SqlDataSource()        test.ConnectionString = ConfigurationManager.ConnectionStrings("DatabaseConnectionString").ToString()        test.UpdateCommandType = SqlDataSourceCommandType.Text        test.UpdateCommand = "UPDATE try SET name = '" + myname + "' , age = '" + myage + "' , email = '" + myemail + "' WHERE roll                                                         123 "        test.Update()but i have to use the SELECT command like this which is completely different from INSERT and  UPDATE commands   Dim tblData As New Data.DataTable()         Dim conn As New Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated                                                                                Security=True;User Instance=True")   Dim Command As New Data.SqlClient.SqlCommand("SELECT * FROM try WHERE age = '100' ", conn)   Dim da As New Data.SqlClient.SqlDataAdapter(Command)   da.Fill(tblData)   conn.Close()                   TextBox4.Text = tblData.Rows(1).Item("name").ToString()        TextBox5.Text = tblData.Rows(1).Item("age").ToString()        TextBox6.Text = tblData.Rows(1).Item("email").ToString()       for INSERT and UPDATE commands defining the command,commandtype and connectionstring is samebut for the SELECT command it is completely different. why ?can i define the command,commandtype and connectionstring for SELECT command similar to INSERT and UPDATE ?if its possible how to do ?please help me

View 2 Replies View Related

Insert Command Fails When I Want To Insert Records In Data Table

Apr 20, 2008

On my site users can register using ASP Membership Create user Wizard control.
I am also using the wizard control to design a simple question and answer  form that logged in users have access to.
it has 2 questions including a text box for Q1 and  dropdown list for Q2.
I have a table in my database called "Players" which has 3 Columns
UserId Primary Key of type Unique Identifyer
PlayerName Type String
PlayerGenre Type Sting
 
On completing the wizard and clicking the finish button, I want the data to be inserted into the SQl express Players table.
I am having problems getting this to work and keep getting exceptions.
 Be very helpful if somebody could check the code and advise where the problem is??
 
 
<asp:Wizard ID="Wizard1" runat="server" BackColor="#F7F6F3"
BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"
DisplaySideBar="False" Font-Names="Verdana" Font-Size="0.8em" Height="354px"
onfinishbuttonclick="Wizard1_FinishButtonClick" Width="631px">
<SideBarTemplate>
<asp:DataList ID="SideBarList" runat="server">
<ItemTemplate>
<asp:LinkButton ID="SideBarButton" runat="server" BorderWidth="0px"
Font-Names="Verdana" ForeColor="White"></asp:LinkButton>
</ItemTemplate>
<SelectedItemStyle Font-Bold="True" />
</asp:DataList>
</SideBarTemplate>
<StepStyle BackColor="#669999" BorderWidth="0px" ForeColor="#5D7B9D" />
<NavigationStyle VerticalAlign="Top" />
<WizardSteps>
<asp:WizardStep runat="server">
<table class="style1">
<tr>
<td class="style4">
A<span class="style6">Player Name</span></td>
<td class="style3">
<asp:TextBox ID="PlayerName" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="PlayerName" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style5">
 
<td class="style3">
<asp:DropDownList ID="PlayerGenre" runat="server" Width="128px">
<asp:ListItem Value="-1">Select Genre</asp:ListItem>
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:DropDownList>
</td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="PlayerGenre" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
 
</tr>
</table>
  Sql Data Source
<asp:SqlDataSource ID="InsertArtist1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" InsertCommand="INSERT INTO [Playerst] ([UserId], [PlayerName], [PlayerGenre]) VALUES (@UserId, @PlayerName, @PlayerGenre)"
 
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>">
<InsertParameters>
<asp:Parameter Name="UserId" Type="Object" />
<asp:Parameter Name="PlayerName" Type="String" />
<asp:Parameter Name="PlayerGenre" Type="String" />
</InsertParameters>
 
 
</asp:SqlDataSource>
</asp:WizardStep>
 
 Event Handler
 
To match the answers to the user I get the UserId and insert this into the database to.protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
 SqlDataSource DataSource = (SqlDataSource)Wizard1.FindControl("InsertArtist1");
MembershipUser myUser = Membership.GetUser(this.User.Identity.Name);
Guid UserId = (Guid)myUser.ProviderUserKey;String Gender = ((DropDownList)Wizard1.FindControl("PlayerGenre")).SelectedValue;
DataSource.InsertParameters.Add("UserId", UserId.ToString());DataSource.InsertParameters.Add("PlayerGenre", Gender.ToString());
DataSource.Insert();
 
}
 

View 1 Replies View Related

Using A Variable In SSIS - Error - Command Text Was Not Set For The Command Object..

Nov 4, 2006

Hi All,

i am using a OLE DB Source in my dataflow component and want to select rows from the source based on the Name I enter during execution time. I have created two variables,

enterName - String packageLevel (will store the name I enter)

myVar - String packageLevel. (to store the query)

I am assigning this query to the myVar variable, "Select * from db.Users where (UsrName = " + @[User::enterName] + " )"

Now in the OLE Db source, I have selected as Sql Command from Variable, and I am getting the variable, enterName,. I select that and when I click on OK am getting this error.

Error at Data Flow Task [OLE DB Source [1]]: An OLE DB error has occurred. Error code: 0x80040E0C.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E0C Description: "Command text was not set for the command object.".

Can Someone guide me whr am going wrong?

myVar variable, i have set the ExecuteAsExpression Property to true too.

Please let me know where am going wrong?

Thanks in advance.








View 12 Replies View Related

Strange Insert Problem

Mar 8, 2007

question structure
- code
- message after execute qurie
- question
- database diagram


CODE:

SET DATEFORMAT dmy;
INSERT INTO tblAddress (fkCityId, strAddressFull)
SELECT pkCityId,'street_209'
FROM tblCity
WHERE strCityName = 'Test-City';

INSERT INTO tblCustomer (fkCustomerLanguageId, fkCustomerGenderId, strCustomerName, strCustomerFirstname, dtCustomerBirthDate) SELECT pkLanguageId, pkCustomerGenderId,'test','user','8/03/2007 9:25:17'
FROM tblCustomerGender, tblCustomerLanguage
WHERE tblCustomerGender.strCustomerGenderName ='Male' and tblCustomerLanguage.strLanguageAbbrev ='Dutch';

INSERT INTO tblCustomerAddress(fkCustomerId, fkAddressId)
SELECT c.pkCustomerId, a.pkAddressId
FROM tblCustomer AS c, tblAddress AS a
WHERE c.strCustomerName = 'test' and c.strCustomerFirstname = 'user' and c.dtCustomerBirthDate = '8/03/2007 9:25:17' and a.strAddressFull ='street_209';

INSERT INTO tblAddressCategorie(fkCategorieAddressId, fkAddressId)
SELECT c.pkCategorieAddressId, a.pkAddressId FROM tblAddress AS a, tblCategorieAddress AS c
WHERE c.strCategorieName = 'Invoice' and a.strAddressFull = 'street_209';

INSERT INTO tblAddressCategorie(fkCategorieAddressId, fkAddressId)
SELECT c.pkCategorieAddressId, a.pkAddressId
FROM tblAddress AS a, tblCategorieAddress AS c
WHERE c.strCategorieName = 'Privat' and a.strAddressFull = 'street_209';



MESSAGE:

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(0 row(s) affected)


QUESTION:
last insert query is not done... why, because he is the same as the query before (only the data is different)???

if i only insert 1 thing in tblAddressCategorie, then he insert it correctly
if i insert 2 things he only insert the first
if i insert 3 things he only insert the first 2
if i insert 4 things he only insert the first 3
if i ...


DATABASE DIAGRAM:
database diagram that is involved with this problem:
see picture

View 2 Replies View Related

Command Text Was Not Set For The Command Object Error

Sep 19, 2006

Hi. I am writing a program in C# to migrate data from a Foxpro database to an SQL Server 2005 Express database. The package is being created programmatically. I am creating a separate data flow for each Foxpro table. It seems to be doing it ok but I am getting the following error message at the package validation stage:

Description: An OLE DB Error has occured. Error code: 0x80040E0C.

An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E0C Description: "Command text was not set for the command object".

.........

Description: "component "OLE DB Destination" (22)" failed validation and returned validation status "VS_ISBROKEN".

This is the first time I am writing such code and I there must be something I am not doing correct but can't seem to figure it out. Any help will be highly appreciated. My code is as below:

private bool BuildPackage()

{




// Create the package object

oPackage = new Package();

// Create connections for the Foxpro and SQL Server data

Connections oPkgConns = oPackage.Connections;

// Foxpro Connection

ConnectionManager oFoxConn = oPkgConns.Add("OLEDB");

oFoxConn.ConnectionString = sSourceConnString; // Created elsewhere

oFoxConn.Name = "SourceConnectionOLEDB";

oFoxConn.Description = "OLEDB Connection For Foxpro Database";

// SQL Server Connection

ConnectionManager oSQLConn = oPkgConns.Add("OLEDB");

oSQLConn.ConnectionString = sTargetConnString; // Created elsewhere

oSQLConn.Name = "DestinationConnectionOLEDB";

oSQLConn.Description = "OLEDB Connection For SQL Server Database";

// Add Prepare SQL Task

Executable exSQLTask = oPackage.Executables.Add("STOCK:SQLTask");

TaskHost thSQLTask = exSQLTask as TaskHost;

thSQLTask.Properties["Connection"].SetValue(thSQLTask, "oSQLConn");

thSQLTask.Properties["DelayValidation"].SetValue(thSQLTask, true);

thSQLTask.Properties["ResultSetType"].SetValue(thSQLTask, ResultSetType.ResultSetType_None);

thSQLTask.Properties["SqlStatementSource"].SetValue(thSQLTask, @"C:LPFMigrateLPF_Script.sql");

thSQLTask.Properties["SqlStatementSourceType"].SetValue(thSQLTask, SqlStatementSourceType.FileConnection);

thSQLTask.FailPackageOnFailure = true;



// Add Data Flow Tasks. Create a separate task for each table.

// Get a list of tables from the source folder

arFiles = Directory.GetFileSystemEntries(sLPFDataFolder, "*.DBF");

for (iCount = 0; iCount <= arFiles.GetUpperBound(0); iCount++)

{


// Get the name of the file from the array

sDataFile = Path.GetFileName(arFiles[iCount].ToString());

sDataFile = sDataFile.Substring(0, sDataFile.Length - 4);

oDataFlow = ((TaskHost)oPackage.Executables.Add("DTS.Pipeline.1")).InnerObject as MainPipe;

oDataFlow.AutoGenerateIDForNewObjects = true;



// Create the source component

IDTSComponentMetaData90 oSource = oDataFlow.ComponentMetaDataCollection.New();

oSource.Name = (sDataFile + "Src");

oSource.ComponentClassID = "DTSAdapter.OLEDBSource.1";

// Get the design time instance of the component and initialize the component

CManagedComponentWrapper srcDesignTime = oSource.Instantiate();

srcDesignTime.ProvideComponentProperties();

// Add the connection manager

if (oSource.RuntimeConnectionCollection.Count > 0)

{


oSource.RuntimeConnectionCollection[0].ConnectionManagerID = oFoxConn.ID;

oSource.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(oFoxConn);

}

// Set Custom Properties

srcDesignTime.SetComponentProperty("AccessMode", 0);

srcDesignTime.SetComponentProperty("AlwaysUseDefaultCodePage", true);

srcDesignTime.SetComponentProperty("OpenRowset", sDataFile);

// Re-initialize metadata

srcDesignTime.AcquireConnections(null);

srcDesignTime.ReinitializeMetaData();

srcDesignTime.ReleaseConnections();

// Create Destination component

IDTSComponentMetaData90 oDestination = oDataFlow.ComponentMetaDataCollection.New();

oDestination.Name = (sDataFile + "Dest");

oDestination.ComponentClassID = "DTSAdapter.OLEDBDestination.1";

// Get the design time instance of the component and initialize the component

CManagedComponentWrapper destDesignTime = oDestination.Instantiate();

destDesignTime.ProvideComponentProperties();

// Add the connection manager

if (oDestination.RuntimeConnectionCollection.Count > 0)

{


oDestination.RuntimeConnectionCollection[0].ConnectionManagerID = oSQLConn.ID;

oDestination.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.ToConnectionManager90(oSQLConn);

}

// Set custom properties

destDesignTime.SetComponentProperty("AccessMode", 2);

destDesignTime.SetComponentProperty("AlwaysUseDefaultCodePage", false);

destDesignTime.SetComponentProperty("OpenRowset", "[dbo].[" + sDataFile + "]");



// Create the path to link the source and destination components of the dataflow

IDTSPath90 dfPath = oDataFlow.PathCollection.New();

dfPath.AttachPathAndPropagateNotifications(oSource.OutputCollection[0], oDestination.InputCollection[0]);

// Iterate through the inputs of the component.

foreach (IDTSInput90 input in oDestination.InputCollection)

{


// Get the virtual input column collection

IDTSVirtualInput90 vInput = input.GetVirtualInput();

// Iterate through the column collection

foreach (IDTSVirtualInputColumn90 vColumn in vInput.VirtualInputColumnCollection)

{


// Call the SetUsageType method of the design time instance of the component.

destDesignTime.SetUsageType(input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READWRITE);

}

//Map external metadata to the inputcolumn

foreach (IDTSInputColumn90 inputColumn in input.InputColumnCollection)

{


IDTSExternalMetadataColumn90 externalColumn = input.ExternalMetadataColumnCollection.New();

externalColumn.Name = inputColumn.Name;

externalColumn.Precision = inputColumn.Precision;

externalColumn.Length = inputColumn.Length;

externalColumn.DataType = inputColumn.DataType;

externalColumn.Scale = inputColumn.Scale;

// Map the external column to the input column.

inputColumn.ExternalMetadataColumnID = externalColumn.ID;

}

}

}

// Add precedence constraints to the package executables

PrecedenceConstraint pcTasks = oPackage.PrecedenceConstraints.Add((Executable)thSQLTask, oPackage.Executables[0]);

pcTasks.Value = DTSExecResult.Success;

for (iCount = 1; iCount <= (oPackage.Executables.Count - 1); iCount++)

{


pcTasks = oPackage.PrecedenceConstraints.Add(oPackage.Executables[iCount - 1], oPackage.Executables[iCount]);

pcTasks.Value = DTSExecResult.Success;

}

// Validate the package

DTSExecResult eResult = oPackage.Validate(oPkgConns, null, null, null);

// Check if the package was successfully executed

if (eResult.Equals(DTSExecResult.Canceled) || eResult.Equals(DTSExecResult.Failure))

{


string sErrorMessage = "";

foreach (DtsError pkgError in oPackage.Errors)

{


sErrorMessage = sErrorMessage + "Description: " + pkgError.Description + "";

sErrorMessage = sErrorMessage + "HelpContext: " + pkgError.HelpContext + "";

sErrorMessage = sErrorMessage + "HelpFile: " + pkgError.HelpFile + "";

sErrorMessage = sErrorMessage + "IDOfInterfaceWithError: " + pkgError.IDOfInterfaceWithError + "";

sErrorMessage = sErrorMessage + "Source: " + pkgError.Source + "";

sErrorMessage = sErrorMessage + "Subcomponent: " + pkgError.SubComponent + "";

sErrorMessage = sErrorMessage + "Timestamp: " + pkgError.TimeStamp + "";

sErrorMessage = sErrorMessage + "ErrorCode: " + pkgError.ErrorCode;

}

MessageBox.Show("The DTS package was not built successfully because of the following error(s):" + sErrorMessage, "Package Builder", MessageBoxButtons.OK, MessageBoxIcon.Information);

return false;

}

// return a successful result

return true;
}

View 2 Replies View Related

Strange Error

Aug 3, 2006

I am using c# and ASP.NET 2 and I am getting a very strange error. I
have a field called CompanyID in SQL Server 2005, and it allows null
values in it. When this CompanyID is not NULL, ie for example it is
202, then when i press the update button it allows me to update
perfectly in the database. However if the CompanyID is NULL,
and I try to update the companyID, to lets say 202, the application
just crashes with the following message:- System.InvalidCastException: Object cannot be cast from DBNull to other types. I tried to set some breakpoints in the application to debug, however it does not even pass through these breakpoints! Any ideas on what the problem can be or how I can debug? Thanks for your help and time Johann

View 6 Replies View Related

A Strange Error Here...

May 13, 2008

So we currently are running a SQL 7 Server, which hopefully we will be updating this year but untill then we're stuck.  I've got a web app using ASP.NET 2.0 and on occasion I get this error:
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: TCP Provider, error: 0 - Only one usage of each socket address (protocol/network address/port) is normally permitted.) 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 trustServerCert, 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(DbConnectionPoolIdentity identity, 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.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open()

View 2 Replies View Related

Very Strange Error Can Anyone Help With .

Mar 25, 2004

I Some sql that it keeps throwing the following error

SqlDumpExceptionHandler: Process 52 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.

Here is the sql

UPDATE dbo.temptable
SET code = 'MM'
FROM dbo.temptable T
JOIN dbo.Item I WITH (NOLOCK)
ON T.ProductID = P.ProductID
JOIN dbo.cars C WITH (NOLOCK) ON I.ModelID = C.ModelID
JOIN dbo.carmakes CM WITH (NOLOCK) ON CM.MakeID = C.MakeID
JOIN dbo.CarDealerMakes CDM WITH (NOLOCK)
ON CM.MakeID = CDM.MakeID
WHERE T.ProductID NOT IN (

SELECT distinct A.ProductID
FROM dbo.Action A WITH (NOLOCK)
JOIN dbo.ActionPurchases AP WITH (NOLOCK)
ON A.ActionID = AP.ActionID
WHERE A.CustomerID = 2

UNION

SELECT distinct A.ProductID
FROM dbo.Action A WITH (NOLOCK)
JOIN dbo.ActionServices S WITH (NOLOCK)
ON A.ActionID = S.ActionID
WHERE 2 = A.ProductID)

That sql will run on windows 2000 but it will not run on windows 2003.
I have the latest service pack.

Has anyone ever come across this before or have and suggestions ?

View 2 Replies View Related

Strange Error

Nov 19, 2006

Hello
I have one PC with SQL server 2000 and I am working on one database called TaxReg but today I found it gray and (suspect) beside it
could you please tell what is the problem and how to fix it ?

View 1 Replies View Related

Strange Error

May 19, 2008

SELECT TOP 9 id,vehicleref,capid,manufacturer,model,derivative,ch,'3' as term,'10000' as mileage,'orderby' as orderby,cvehicle_shortmodtext,source,studioimages FROM vwAllMatrixWithLombardAndShortModel
WHERE locatcode =1
GROUP BY id,vehicleref,capid,manufacturer,model,derivative,ch,term,mileage,orderby,cvehicle_shortmodtext,source,studioimages

Msg 207, Level 16, State 1, Line 2
Invalid column name 'mileage'.
Msg 207, Level 16, State 1, Line 2
Invalid column name 'orderby'.

Can anyone help?

Thanks

View 2 Replies View Related

Some Strange Error

Aug 3, 2006

Hi,

In my package I am executing 8 'Execute package' tasks which calls 8 different packages. All these tasks are indepent so they are not connected to each other. In each package I have defined a variable at the start of each package there is a script task to assign the 'StartTime' system variable value to the user defined variable.

If I run the tasks individually, it is running without any problem. When I am running all the tasks in the parent package, very often the package fails and each time different different tasks are failing. But the error happens at the script task which is used to define the start time. The error message is 'Error: The script threw an exception: Object reference not set to an instance of an object.'. But inside the script task, I have only one statement which assigns the system start time value to the user variable. Also, in my log file, I am getting 2 entries for all the tasks in that failing child package, but I have not specified any looping in my parent package. One more peculiar thing is even though as per the log entry it ran twice, no single record is inserted/updated(????).

Anybody have any idea of this problem?

Thanks.

View 1 Replies View Related

Strange Error

Apr 25, 2006

I am getting the following error when I try to debug a package that needs to Copy Columns from an AS400 database into SQL 2005:

[SQL Server Destination [1684]] Error: An OLE DB error has occurred. Error code: 0x80040E14. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E14 Description: "Could not bulk load because SSIS file mapping object 'GlobalDTSQLIMPORT ' could not be opened. Operating system error code 2(The system cannot find the file specified.). Make sure you are accessing a local server via Windows security.".

Has anybody seen this error and what do I need to do and check for?

Thanks for the information.

View 6 Replies View Related

Strange SQL Error...

Oct 2, 2007



I am getting this error on an almost daily basis. Using SQL 2005 fully patched.

I searched the web and couldn't fin anthing about it. has anyone here seen this problem before...

Disk space is fine btw... 35GB free


Message
An error occurred while writing an audit trace. SQL Server is shutting down. Check and correct error conditions such as insufficient disk space, and then restart SQL Server. If the problem persists, disable auditing by starting the server at the command prompt with the "-f" switch, and using SP_CONFIGURE.


View 10 Replies View Related

Strange SQL CLR Error

Oct 30, 2006

Hello,

I am running the code below that simply adds a row with two values to a Table. When it is run, it gives me the following error:

A .NET Framework error occurred during execution of user defined routine or aggregate 'InsertCurrency':

System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_Sales.Currency'. Cannot insert duplicate key in object 'dbo.SalesCurrency'.

This seems to indicate I am adding a duplicate key, however I have confirmed several times that I am not adding a duplicate key.

Here is the code. Thanks for any suggestions about why this error is occuring.

<SqlProcedure()> _

Public Shared Sub InsertCurrency(ByVal currencyCode As SqlString, ByVal name As SqlString)

Using conn As New SqlConnection("context connection=true")

Dim InsertCurrencyCommand As New SqlCommand()

Dim currencyCodeParam As New SqlParameter("@CurrencyCode", SqlDbType.NVarChar)

Dim nameParam As New SqlParameter("@Name", SqlDbType.NVarChar)

currencyCodeParam.Value = currencyCode

nameParam.Value = name

InsertCurrencyCommand.Parameters.Add(currencyCodeParam)

InsertCurrencyCommand.Parameters.Add(nameParam)

InsertCurrencyCommand.CommandText = _

"INSERT SalesCurrency (CurrencyCode, Name) VALUES(@CurrencyCode, @Name)"

InsertCurrencyCommand.Connection = conn

'

conn.Open()

InsertCurrencyCommand.ExecuteNonQuery()

conn.Close()

End Using

End Sub

View 2 Replies View Related

SQL INSERT Command

Sep 16, 2006

Hello!I have problems with my SQL insert command..string zdroj = "server=LIBRA; database=ufd; uid=sa; password=555; ";string dotaz = "SELECT heslo FROM tbl_UFD_Uzivatelia WHERE meno='"+meno.Text+"'";SqlConnection conn = new SqlConnection(zdroj);SqlCommand sqlCmd = new SqlCommand(dotaz, conn);conn.Open(); SqlDataReader reader; reader = sqlCmd.ExecuteReader();reader.Read();Does something exist as oposite of DataReader? How can I execute insert command?Hope you will help me, thanx a lot

View 6 Replies View Related

Insert Command

Sep 29, 2006

How to pass insert sqlquery using dataset

View 2 Replies View Related

Help With Insert Into Command...

Jan 10, 2007

Hi guys! I have an INSERT INTO sqlcommand that inserts values into a table from another table. Why do I always get this error?
Violation of PRIMARY KEY constraint 'PK_TE_shounin_zangyou'. Cannot insert duplicate key in object 'dbo.TE_shounin_zangyou'.The statement has been terminated.
Here's the insert command...
      Dim update_phase As New SqlCommand("INSERT INTO TE_shounin_zangyou (syain_No,date_kyou,time_kyou) SELECT syain_No,date_kyou,time_kyou FROM TE_zangyou WHERE [syain_No] = @syain_No", cnn)      
The table where I would want to insert data is empty, but I get this error. What seems to be the problem?
Thanks.
Audrey

View 8 Replies View Related

Insert Command

Jan 28, 2007

i want to include an insert command to enable admin user to insert new record through the grid view but for some reason the insert command doesnt work, and i want the page to just display the record of the restaurant name "Sakura Yeshi" but i cannot do that and i dont know why? Can somebody help me out with this? i know this might be easy but just i dont know how to deal with it. Thanks
My Code:<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)        Dim resmen As String        Dim connection As SqlConnection = New SqlConnection()        connection.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ToString()
        resmen = ("SELECT resname,menu,price,date FROM rest_info WHERE resname = 'sakura yeshi'")        Dim myCommand As SqlCommand = New SqlCommand(resmen, connection)
        connection.Open()        Dim dr As SqlDataReader = myCommand.ExecuteReader()               While dr.Read()            admingrid.DataBind()                End While        connection.Close()    End Sub</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">    <strong>Sakura Yeshi Admin Page<br />    <asp:GridView ID="admingrid" runat="server" AutoGenerateColumns="False" CaptionAlign="Left" DataSourceID="SqlDataSource1" Style="z-index: 100; left: 163px; position: absolute; top: 182px">         <Columns>               <asp:CommandField ShowdeleteButton="True" ShowEditButton ="True" ShowinsertButton="True" />                <asp:BoundField DataField="resname" HeaderText="resname" ReadOnly="True" SortExpression="resname" />                <asp:BoundField DataField="menu" HeaderText="menu" SortExpression="menu" />                <asp:BoundField DataField="price" HeaderText="price" SortExpression="price" />                <asp:BoundField DataField="date" HeaderText="date" SortExpression="date" />            </Columns>
        </asp:GridView>        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"            SelectCommand="SELECT [resname], [menu], [price], [date] FROM [rest_info]"            DeleteCommand="DELETE FROM [rest_info] WHERE [resname] = 'sakura yeshi'"             InsertCommand="INSERT INTO [rest_info] ([resname], [menu], [price], [date]) VALUES (@resname, @menu, @date, @price)"            UpdateCommand="UPDATE [rest_info] SET [resname] = @resname, [menu] = @menu, [price] = @price, [date] = @date WHERE [resname] = 'sakura yeshi'">
<InsertParameters>                <asp:Parameter Name="resname" Type="Char" />                <asp:Parameter Name="menu" Type="char" />                <asp:Parameter Name="price" Type="Decimal" />                <asp:Parameter Name="date" Type="datetime" />            </InsertParameters>            <UpdateParameters>                <asp:Parameter Name="resname" Type="Char" />                <asp:Parameter Name="menu" Type="char" />                <asp:Parameter Name="price" Type="Decimal" />                <asp:Parameter Name="date" Type="datetime" />            </UpdateParameters>            <DeleteParameters>                <asp:Parameter Name="resname" Type="String" />            </DeleteParameters></asp:SqlDataSource></asp:Content>

View 8 Replies View Related

Insert By Command.

Jul 18, 2007

Hi,
I am creating a page which has 5 text boxes.
Firstname, lastname, pass, zip, email
and a command button. now when i click this button i want it to use a stored procedure and insert the values from the text box to db table. i dont know what code to put in the command button.

View 3 Replies View Related

Insert Command

Nov 11, 2005

I have three tables t1, t2, t3. I want to insert a new row in t1. I am using access 2000 with sql commands for the queries. There are 4 colums in t1. I know the values of two of the colums. The remaining two columns values are going to be look up in the other 2 tables, 1 value from t2 table and the other value from t3.. I need this to be in one statement. From what I have seen you can either use insert with values() or you can populate your table with unkown values from another table. But I want to do both, since 2 of my values are known and the other 2 need to come from another table.

I hope that I made it clear enough. Can anyone help me

Thanks

View 4 Replies View Related

Sql Insert Command Help

May 16, 2007

i am completely new to sql commands so i really need the help on this one.



I have three tables and they go like this



--User Table

firstTable->integerID

firstTable->stringName



--Group Table

secondTable->integerID

secondTable->stringName



--User to Groups table

thirdTable->integerFirstID

thirdTable->integerSecondID

thirdTable->stringDescription



the first table is has a user id and name and the second table has a group id and name, the third table keeps track of how many groups the user is assigned to. The problem i am having is writing a sql insert into command to add more entries to the third table from an asp.net 2.0 page, my sql command is incorrect.



The problem i am having i think, is that i am populating a dropdownlist with the names of all of the groups and when i select one that should be the group i am assigning to the user, the problem is, is that i dont know how to associated that dropdownlist string's name with its ID so that it can be passed to my insert command. is there a way to accomplish this all as a sql command? because i have a formview with a multiview and then a gridview under nested under all of that, and it would be a pain to write a event to work with all of the that.



if i do this it works

INSERT INTO ThirdTable (UserID,GroupID,Description) VALUES '318', '2', 'some description')



View 3 Replies View Related

Strange Constraint Error

Feb 2, 2007

I have a table called subscribers with the following fields
CustID  (identity)email  (text) fname  (text)lname  (text) - may be emptysubDate  (smalldate)Confirmed (boolean) - initially will be emptyConDate  (smalldate) - initially will be empty
I have a strongly typed dataset that contains only the one table. It has the method GetDataByIsSubscribed
SELECT     emailFROM         SubscribersWHERE     (email = @email)
And I have a function which calls it
Public Function ValSubscribe(ByVal vEmailAddr As String, ByVal vFName As String, ByVal vLName As String) As String    Dim SubscriptionAdapter As New EmailSubscriptionsTableAdapters.SubscribersTableAdapter    Dim dF As Data.DataTable = SubscriptionAdapter.GetDataByIsSubscribed(vEmailAddr)    If dF.Rows.Count > 0 Then        ValSubscribe = "This email address is already subscribed!"    Else        SubscriptionAdapter.InsertSubscriber(vEmailAddr, vFName, vLName, Now)        ValSubscribe = "success"    End IfEnd Function
This is an existing table that contains duplicate email addresses, but I don't want to add any more dups. 
You can see I have another method to add records, which works fine, though I've only tried to add email addresses that I know aren't in the table.  If I run the above code which first checks to see if an email address is in the table, and I use an email address that is, I get the following error
System.Data.ConstraintException was unhandled by user code  Message="Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."  Source="System.Data"  StackTrace:       at System.Data.DataTable.EnableConstraints()       at System.Data.DataTable.set_EnforceConstraints(Boolean value)       at System.Data.DataTable.EndLoadData()       at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)       at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)       at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)       at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)       at EmailSubscriptionsTableAdapters.SubscribersTableAdapter.GetDataByIsSubscribed(String email) in C:WINNTMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Fileswap48b4654224232ecApp_Code.ihd33v1_.4.vb:line 872       at Validate.ValSubscribe(String vEmailAddr, String vFName, String vLName) in C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesWAPApp_CodeValidate.vb:line 90       at Validate.vCheckPage(String vEmailAddr, Int32 vLevel, String vFName, String vLName) in C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesWAPApp_CodeValidate.vb:line 28       at advertise.Page_Load(Object sender, EventArgs e) in C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2005WebSitesWAPform-advertise.aspx.vb:line 32       at System.Web.UI.Control.OnLoad(EventArgs e)       at System.Web.UI.Control.LoadRecursive()       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I think I understand what this error is telling my, but I don't get why.  All the fields except CustID allow nulls.  There are no foreign-keys, and I don't see where any fild by custID requires unique entries.  If I run the query in the designer, I don't have a problem. 
What am I missing?
Diane

View 11 Replies View Related

Strange Error In Sql Server?

Apr 13, 2007

i m using sql server 2000. My problem is tht no matter what date i enter, sql server always displays it as
1900-1-1. This is happening on all columns which have been specified as datetime. Whts the problem & the solution to the problem?

View 3 Replies View Related

Strange Conversion Error

Nov 16, 2004

I have a function that retrieves a data set from a passed SQL string. I'm getting this weird error.


Input string was not in a correct format

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.FormatException: Input string was not in a correct format.

Source Error:


Line 205: sSQL = "Select * From LedgerDetails Where LedgerID = " & _LedgerID.ToString()
Line 206: msgbox(sSQL)
Line 207: TransactionDetails = GetDataSet(sSQL)
Line 208:
Line 209: _TransactionsIndex = CShort(Val(GetDataValue("Select Count() From LedgerDetails Where LedgerID = " & CStr(_LedgerID)))) -1


Source File: C:Documents and SettingsOwnerMy DocumentsUniversityFall 2004DSSASP WorkAlgorithmTest.aspx Line: 207

Stack Trace:

[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat) +184
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) +96

[InvalidCastException: Cast from string "Select * From LedgerDetails Wher" to type 'Integer' is not valid.]
Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value) +211


I have no idea why, but it seems to trying to convert the string into an integer. Both the argument and the parameter in the function are strings. I checked on the internet and the usual response is this is because the SQL is incomplete, but I have it showing me the compiled SQL string, and it is not imcomplete. I've tried hotwiring the query to match something I know will work, and I still get the same error. I've also tried compile the string using .ToString() on my number portion, storing the converted number into a string and only combining strings on the call, using another string variable as a temporary holder, using the String.Concat function, and even CStr. There is no way possible that this thing is an integer when the call is sent...

Any ideas?

Shawn

View 1 Replies View Related

Suddenly Getting STRANGE Error...

May 11, 2006

I've been building a simple test application and things have been working all day. Suddenly, about a half an hour ago - I started getting this error every time I attempt to go to the main web page:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
I have no idea what changed... Can someone help me figure this out please?
Thanks!~A~

View 3 Replies View Related

Strange Conversion Error

Jan 2, 2008

Hi,

I keep getting this conversion error when I run this query: If I comment from the second part of the where clause it goes away? I can't figure out how to fix this!

Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'B' to data type int.

Select sE.SSN,
sE.enroll_yyyyQ_Code,
sE.Sched_Switch,
sE.gdb_Switch,
sE.Fee_Switch,
sE.Rank_Code,
sE.Class_Code,
sE.Status_Code,
sE.Prim_Coll_Code,
sE.Secondary_Coll_Code,
sE.Dept_Major_Code,
sR.Client_ID,
sR.Contact_Number,
master.dbo.fn_InitCap(nM.last_name) Last_Name,
master.dbo.fn_InitCap(nM.first_name) First_Name,
master.dbo.fn_InitCap(nM.mid_name) Middle_Name,
nM.sfx_name,
eA.Published_eMail_Address
/* Tables ................................................................ */
From FCoBDB.Student_Current.dbo.enrollment sE With ( noLock )
JOIN FCOBDB.Student_Current.dbo.Name nM With ( noLock )
ON sE.SSN = nM.SSN
LEFT OUTER JOIN FCoBDB.Student_Current.dbo.eMail_Address eA With ( noLock )
ON sE.SSN = eA.SSN
LEFT OUTER JOIN ADIS_Import_Support.dbo.Student_Records sR With ( noLock )
ON sE.SSN = sR.SSN
/* Selection Clauses ...................................................... */
Where
/* Undergraduate Business Students .................................. */
( sE.prim_coll_code = 'BUS' and
sE.dept_major_code <> '805' and
sE.status_code = 1 and /* Good citizens */
sE.enroll_yyyyq_code = 20074 and /* current quarter only */
sR.Client_ID IS NULL ) /* Data not in Maximizer! */
or /* Executive Education Students ..................................... */
( sE.prim_coll_code = 'GRD' and
sE.dept_major_code = '296' and
sE.status_code = 1 and /* Good citizens */
sE.enroll_yyyyq_code = 20074 and /* current quarter only */
sR.Client_ID IS NULL ) /* Data not in Maximizer */
/* Sort Options ........................................................... */
order By nM.last_name, nM.first_name ;





View 4 Replies View Related

Strange Deserialization Error

Jun 25, 2007

So, I'm trying to deserialize a .NET object inside a CLR procedure; I've used SGEN to make an "xmlserialization" version of the object library, and registered it and the original assembly in SQL Server and referenced them from my CLR Procedure project.

Now, I receive the object as an XML Document and I'm trying to use XMLSerializer to deserialize the XML back into my object. If I try to specify the XMLRoot when I declare the XMLSerializer and deploy it SQL gives me the (in)famous can't use dynamically created assemblies error.

I could really use any help/inspiration/assistance!!

Here's most of the code:

Dim myCaseType As CaseMessageType = CType(myRead.ReadContentAsInt(), CaseMessageType)
SqlContext.Pipe.Send("Case Type=" & myCaseType.ToString())
Dim myXmlRoot As New XmlRootAttribute(CaseMessageElement) myXmlRoot.Namespace = CaseMessageSchema
SqlContext.Pipe.Send("Getting the type of the message") Dim myType As System.Type = GetCaseMessageSystemType(myCaseType)


SqlContext.Pipe.Send("Cretating xml serilizer object"

)
'this "works" but it won't deserialize
Dim xmlSerializer As New XmlSerializer(myType)
'this doesn't work, it gives me the error
'Dim xmlSerializer As New XmlSerializer(myType, myXmlRoot)
SqlContext.Pipe.Send("Deserialize the message")
myCase =

DirectCast(xmlSerializer.Deserialize(myRead), CaseMessage)

View 7 Replies View Related

Strange IE7 Script Error

Dec 2, 2007

Big problem!
Win XP SP2 IE7. All up to date
My user profile gets a script error many times like: When trying to open certain web pages. When trying to print any web page. When trying to highlight for a copy paste on certain web pages. When trying to print an email in Eudora 7.
This only happens for my user profile. My wifes user account operates perfectly. When I created a new user account the problem is the same as my corrupted profile.
I have been thru all the Microsoft fixes for this issue as documented in http://support.microsoft.com/kb/308260
Further I have followed thise instructions for both user profiles.
There must be a way to correct the corrupted settings fro my profile?
I use Norton Internet Security which is up to date and the problem persists even when NIS is deactivated.
The script error window that appears contains no data (blank) for all fields that normally have diagnostic info.
Please help
Thanks, Paul

View 3 Replies View Related

Strange SQL-server Error

Feb 13, 2008

I get this SQL-sever error in my application. I guess it has something to do with the declaration of namespaces? Does anyone know for sure? Thanks in advance!

The type 'System.Data.Selclient.SqlConnection' exists in both
'c:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.Data.dll' and 'crogramMicrosoft Visual
Studio 8Common7IDEPublicAssembliesSystem.Data.SqlClient.dll'

View 11 Replies View Related







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