Urgent Help Needed ! TempTable Doesn't Store Any Data
Jun 6, 2002
Hi group,
I don't know what I should try next, all of my tries have been without results in this case. I just wanted to create a temporary table, then insert one row into it and then use this row to compare if this row exists in another table or not. This is my script:
------------------------
CREATE PROCEDURE imp_Tippimport (@TGName char(33)) AS
BEGIN
CREATE TABLE #tTippgeber (
TGName2 char(33)
)
INSERT INTO #tTippgeber (TGName2)
VALUES (@TGName)
*** see below ***
IF NOT exists (select TGName FROM Tippgeber WHERE TGName = @TGName)
INSERT INTO Tippgeber SELECT TGName2 FROM #tTippgeber
/* SELECT * INTO Tippgeber FROM #tTippgeber */
ELSE
UPDATE Tippgeber SET
TGName = t.TGName2
FROM #tTippgeber AS t, Tippgeber
WHERE TGName = t.TGName2
END
GO
I also created a cursor and used a fetch in to a veriable in the line with the stars to see the value of TGName2 but it was NULL.
Any ideas ?!
Thanks for any help !!
Sascha
View 1 Replies
ADVERTISEMENT
Dec 11, 2007
Hi!
I have several problems of my coding, please give me some advice.
1. How to let result data place at temptable temperary for other mapping? should i create temptable first ?
2. When I got the duplicated record result, I require to map with the main tables (tblROrder & tblSOrder)to find out the record reference no. Please advice how to handle this issue with reference no. at the outcome.
Many thanks,
New Learner
***Coding as following
SELECT code, SMSNo, holderNo, count(*) From tblROrder
WHERE Day = @Day
GROUP BY code, SMSNo, SholderNo
HAVING COUNT(*) > 1<=====result will be found, but since i didn't get the RefNo at the listing, please advise how to let the outcome with RefNo
INTO #tmpOne (code, SMSNo, holderNo) <====error found
SELECT code, SMSNo, holderNo, GrossAmt, count(*) From tblSOrder
WHERE Day = @prmDay between D1 AND D14
GROUP BY code, SMSNo, holderNo, GrossAmt
HAVING COUNT(*) > 1<=====result will be found, but since i didn't get the RefNo at the listing, please advise how to let the outcome with RefNo
INTO #tmpTwo (code, SMSNo, holderNo) <====error found
View 4 Replies
View Related
Mar 11, 2008
Code:
exec('select RIGHT(00000 + CAST(dh.zipcode AS varchar(5)), 5) as zip, '+@fieldname +' as distance into #distance from sumplicity.dbo.t_distancetohospital dh')
This runs normally and returns the number of rows created. Yet when I do a 'select * from #distance' query, I get a message that #distance doesn't exist.
Where is it storing all of this and how do I access it?
View 1 Replies
View Related
Jul 2, 2006
Basically i make use of FormView in Web Developer Express Edition to create and store information to the database .... what i want to do further is to capture the value within the primary key of the newly created recordset that I set it become auto increament .....this value would be stored within a session string in global condition that allowed any page able to access it .....
View 3 Replies
View Related
Jan 8, 2008
I am new at ASP.net and I am having problems inserting data using C# in ASP.netI have created a table named "Profile" in the MS sql server database named "MyDataBase". There is a field named "ID" that has data type 'uniqueidentifier'.I am confused how to INSERT data into this data field. I have used MS Access and MYSQL in which there is an option of auto increment so we don't a unique identifier for each record.Please tell me what can I do to If I want to have a uniqueidentifier for each new record I INSERT in the "Profile" table of MS sql server database.While trying to insert, I get following errorsCannot insert the value NULL into column 'ID'and I don't know how I can insert something in this field that is of value type unique identifier.Please help me I will be very thankfull of you.
View 5 Replies
View Related
Jan 20, 2007
Hi, I'm trying to do insert some data to the database through typing the a number in a textbox. But i will get this error message whenever i tried putting a number that will be inserted to the database.
Sorry that the codes are quite messy. Please do let me know which part of the coding contains the errors.
Please help me. Thanks.
Server Error in '/WSD Project - Cam-Mart' Application.
String or binary data would be truncated.The statement has been terminated. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: String or binary data would be truncated.The statement has been terminated.Source Error:
Line 26:
Line 27: Protected Sub add_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles add.Click
Line 28: SqlDataSource2.Insert()
Line 29: Response.Redirect("Checkout.aspx")
Line 30: Source File: C:Documents and SettingsAdministratorDesktopWSD Project - Cam-MartOrder.aspx.vb Line: 28 Stack Trace:
[SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2300
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +147
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1021
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +413
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +115
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +392
System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +405
System.Web.UI.WebControls.SqlDataSource.Insert() +13
Order.add_Click(Object sender, EventArgs e) in C:Documents and SettingsAdministratorDesktopWSD Project - Cam-MartOrder.aspx.vb:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +75
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +97
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) +4921
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
The codes that i have is in Order.aspx:
<%@ Page Language="VB" MasterPageFile="~/MainMasterPage.master" AutoEventWireup="false" CodeFile="Order.aspx.vb" Inherits="Order" title="Cam-Mart - Your Cart" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:TextBox ID="ProductID" runat="server" Visible="False"></asp:TextBox>
<asp:TextBox ID="ProductPrice" runat="server" Visible="False"></asp:TextBox><br />
<span style="font-family: Verdana; color: lightsteelblue;">Product Name: </span>
<asp:Label ID="prodName" runat="server" Text="Label" ForeColor="Black"></asp:Label><br />
<span style="font-family: Verdana; color: lightsteelblue;">Product Price: </span><asp:Label ID="price"
runat="server" Text="Label" ForeColor="Black"></asp:Label><br />
<span style="font-family: Verdana"><span style="color: lightsteelblue">Quantity:</span>
</span><asp:TextBox ID="tbQuantity" runat="server" AutoPostBack="True"></asp:TextBox>
<asp:Label ID="lblqty" runat="server" Text="Label"></asp:Label><br />
<asp:TextBox ID="ProductName" runat="server" Visible="False"></asp:TextBox><br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label><br />
<span style="color: lightsteelblue; font-family: Verdana">Your Order Date is: </span>
<asp:Label ID="lblOrderDate" runat="server"></asp:Label><br />
<span style="color: lightsteelblue; font-family: Verdana">Your Delivery Date will be:</span>
<asp:Label ID="lblDeliveryDate" runat="server"></asp:Label><br />
<asp:TextBox ID="dtorderdate" runat="server" Visible="False"></asp:TextBox>
<br />
<asp:TextBox ID="dtdeliverydate" runat="server" Visible="False"></asp:TextBox><br />
<br />
<asp:Button ID="add" runat="server" Text="Add to Cart" /><br />
<asp:Button ID="Back" runat="server" Text="Back" /><br />
<asp:Button ID="checkout" runat="server" Text="Checkout" /><br />
<asp:FormView ID="FormView1" runat="server" DataKeyNames="CustID" DataSourceID="SqlDataSource1">
<EditItemTemplate>
CustID:
<asp:Label ID="CustIDLabel1" runat="server" Text='<%# Eval("CustID") %>'></asp:Label><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update">
</asp:LinkButton>
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</EditItemTemplate>
<InsertItemTemplate>
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</InsertItemTemplate>
<ItemTemplate>
CustID:
<asp:Label ID="CustIDLabel" runat="server" Text='<%# Eval("CustID") %>'></asp:Label><br />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:List Product %>"
SelectCommand="SELECT [CustID] FROM [CustInfo] WHERE ([CustName] = @CustName)">
<SelectParameters>
<asp:ControlParameter ControlID="Label1" Name="CustName" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:List Product %>" DeleteCommand="DELETE FROM [OrderDetail] WHERE [OrderID] = @original_OrderID AND [CustID] = @original_CustID AND [CustName] = @original_CustName AND [OrderDate] = @original_OrderDate AND [TotalValue] = @original_TotalValue AND [Quantity] = @original_Quantity AND [DeliveryDate] = @original_DeliveryDate AND [ProductID] = @original_ProductID AND [ProductName] = @original_ProductName"
InsertCommand="INSERT INTO [OrderDetail] ([CustID], [CustName], [OrderDate], [TotalValue], [Quantity], [DeliveryDate], [ProductID], [ProductName]) VALUES (@CustID, @CustName, @OrderDate, @TotalValue, @Quantity, @DeliveryDate, @ProductID, @ProductName)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [OrderDetail] WHERE ([CustID] = @CustID)"
UpdateCommand="UPDATE [OrderDetail] SET [CustID] = @CustID, [CustName] = @CustName, [OrderDate] = @OrderDate, [TotalValue] = @TotalValue, [Quantity] = @Quantity, [DeliveryDate] = @DeliveryDate, [ProductID] = @ProductID, [ProductName] = @ProductName WHERE [OrderID] = @original_OrderID AND [CustID] = @original_CustID AND [CustName] = @original_CustName AND [OrderDate] = @original_OrderDate AND [TotalValue] = @original_TotalValue AND [Quantity] = @original_Quantity AND [DeliveryDate] = @original_DeliveryDate AND [ProductID] = @original_ProductID AND [ProductName] = @original_ProductName">
<DeleteParameters>
<asp:Parameter Name="original_OrderID" Type="Int32" />
<asp:Parameter Name="original_CustID" Type="Int32" />
<asp:Parameter Name="original_CustName" Type="String" />
<asp:Parameter Name="original_OrderDate" Type="DateTime" />
<asp:Parameter Name="original_TotalValue" Type="Decimal" />
<asp:Parameter Name="original_Quantity" Type="Int32" />
<asp:Parameter Name="original_DeliveryDate" Type="DateTime" />
<asp:Parameter Name="original_ProductID" Type="Int32" />
<asp:Parameter Name="original_ProductName" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="CustID" Type="Int32" />
<asp:Parameter Name="CustName" Type="String" />
<asp:Parameter Name="OrderDate" Type="DateTime" />
<asp:Parameter Name="TotalValue" Type="Decimal" />
<asp:Parameter Name="Quantity" Type="Int32" />
<asp:Parameter Name="DeliveryDate" Type="DateTime" />
<asp:Parameter Name="ProductID" Type="Int32" />
<asp:Parameter Name="ProductName" Type="String" />
<asp:Parameter Name="original_OrderID" Type="Int32" />
<asp:Parameter Name="original_CustID" Type="Int32" />
<asp:Parameter Name="original_CustName" Type="String" />
<asp:Parameter Name="original_OrderDate" Type="DateTime" />
<asp:Parameter Name="original_TotalValue" Type="Decimal" />
<asp:Parameter Name="original_Quantity" Type="Int32" />
<asp:Parameter Name="original_DeliveryDate" Type="DateTime" />
<asp:Parameter Name="original_ProductID" Type="Int32" />
<asp:Parameter Name="original_ProductName" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="FormView1" Name="CustID" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:ControlParameter Name="CustID" Type="Int32" ControlID="FormView1"/>
<asp:ControlParameter Name="OrderDate" Type="DateTime" ControlID="dtorderdate"/>
<asp:ControlParameter Name="TotalValue" Type="Decimal" ControlID="price"/>
<asp:ControlParameter Name="Quantity" Type="Int32" ControlID="lblqty"/>
<asp:ControlParameter Name="DeliveryDate" Type="DateTime" ControlID="dtdeliverydate"/>
<asp:ControlParameter Name="ProductID" Type="Int32" ControlID="ProductID"/>
<asp:ControlParameter Name="ProductName" Type="String" ControlID="prodName"/>
<asp:ControlParameter Name="CustName" Type="String" ControlID="Label1"/>
</InsertParameters>
</asp:SqlDataSource>
</asp:Content>
The text in Order.aspx.vb is :
Partial Class Order
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Dim sUsername As String = " "
Session("Username") = Request.ServerVariables("Auth_user")
Label1.Text = Session("Username")
ProductID.Text = Request("ProductID")
ProductPrice.Text = Request("ProductPrice")
ProductName.Text = Request("ProductName")
lblqty.Text = tbQuantity.Text
prodName.Text = ProductName.Text
price.Text = ProductPrice.Text
dtorderdate.Text = DateTime.Today
dtdeliverydate.Text = DateAdd("d", 7, Date.Today)
lblOrderDate.Text = dtorderdate.Text
lblDeliveryDate.Text = dtdeliverydate.Text
'Dim dtorderdate, dtdeliverydate As DateTime
'lblOrderDate.Text = "Order date: " & dtorderdate.ToString
'lblDeliveryDate.Text = "Delivery date: " & dtdeliverydate.ToString
End Sub
Protected Sub add_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles add.Click
SqlDataSource2.Insert()
Response.Redirect("Checkout.aspx")
End Sub
Protected Sub Back_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Back.Click
Response.Redirect("Catalogs.aspx")
End Sub
Protected Sub checkout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkout.Click
Response.Redirect("Checkout.aspx")
End Sub
End Class
View 2 Replies
View Related
Aug 28, 2007
Hello! I'm trying to get caching work with ASP.NET 2.0 and SQL Server 2005, but I have a problem and I can't figure out what I'm doing
wrong.I have tried to do everything according to the instructions. I
have enabled the database for cache notification by running the
aspnet_regsql tool on the command line like this:aspnet_regsql -S server
-E -d database -etThen I have run the aspnet_regsql tool to enable each
table in the database for cache notification:aspnet_regsql -S server -E
-d database -et -t tablenameI have added the necessary parts into
web.config file, so that it is like
this:<connectionStrings><add name="ConnectionString1"
connectionString="DataSource=servername;Database=databasename;Integrated
Security=True"providerName="System.Data.SqlClient"/> </connectionStrings> <system.web>
<caching> <sqlCacheDependency enabled="true"
pollTime="2000"> <databases> <add
connectionStringName="ConnectionString1"
name="KJ"/> </databases>
</sqlCacheDependency> </caching>I have added this
into global.asax file for the application start event:
System.Data.SqlClient.SqlDependency.Start(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString())To
test caching I wrote this piece of code where I get data from the table
MAAKUNNAT in
the database.----------SqlCacheDependencyAdmin.EnableTableForNotifications(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString(),"MAAKUNNAT")Dim
maakunnatDS As New DataSetIf Cache.Get("maakunnat") Is Nothing
Then Dim myConnection As
NewSqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString())
myConnection.Open() Dim cmd As New SqlCommand("haemaakunnat",
myConnection) cmd.CommandType =
CommandType.StoredProcedure Dim riippuvuus As New
SqlCacheDependency("KJ", "MAAKUNNAT") Dim aggDep As New
AggregateCacheDependency
aggDep.Add(riippuvuus) Dim maakunnatDA As SqlDataAdapter =
New SqlDataAdapter maakunnatDA.SelectCommand =
cmd maakunnatDA.Fill(maakunnatDS, "MAAKUNTA")
myConnection.Close() Cache.Insert("maakunnat", maakunnatDS,
aggDep) Else Response.Write("The data is in the
cache") maakunnatDS = Cache.Get("maakunnat")End
If-----------------But when I run the page I get this
error.------------------------------------------The 'MAAKUNNAT'
table in the database 'KJ' is not enabled for SQL
cachenotification.Please make sure the table exists, and the table
name used for cachedependency matches exactly the table name used in cache
notificationregistration.To enable a table for SQL cache
notification, please useSqlCacheDependencyAdmin.EnableTableForNotifications
method, or the commandline tool aspnet_regsql. To use the tool, please run
'aspnet_regsql.exe -?'for more information.To get a list of enabled
tables in the database, please
useSqlCacheDependencyManager.GetTablesEnabledForNotifications method, or
thecommand line tool
aspnet_regsql.exe.----------------------------------------------When I
run the aspnet_regsql tool with the -lt parameter to get a list of enabled
tables in the database they are all enabled. I have searched many pages in
the internet and I cannot find out what I'm still doing wrong. I'd
appreciate it very much if someone could help me with this
problem.Toni S.
View 5 Replies
View Related
Jul 25, 2006
Hi,
I would like to implement a kind of standard packages which can be used in all other processes and will be started using the variables.
But I do not know where to store these kind of packages in "best practise", because we
- would like to use them in Dev and in "Real" also without having to change something in the other processes
- we are storing the packages in the folders of the package store
and as far as I understood I would have to share the package store to all developers though that they would be able to do this?
Then I would better choose another folder with defined access rights I think...
Or would it be better to spend some time in developing a custom component?
But this component would work with recordsets rather than the standard data flow elemtents and therefor I would expect a leak of performance...
Or is it possible to do "trasnformation" from a packae to a custom component?
Thanks in advice!
cheers,
Markus
View 2 Replies
View Related
Jun 8, 2006
Hey... I really need help here.
I have a website called Project. It has 2 database files. one is ASPNETDB.mdf and another one is project.mdf.
The last time I edited my website was this afternoon. nothing wrong.
Then tonight, when I try to work on the project again, I found out that
I couldn't access the project.mdf database file. The error message
occurs when I try to expand the project.mdf:
Cannot open user default database. Login failed. Login failed for user 'DefaultAndy'
I believe Default is the name of my computer and Andy is the name for
my windows account. I use Windows authentication for that database file.
This is the funny thing. If I rename my project folder under the My
DocumentsVisual Studio 2005WebsiteProject to something else, I will
be able to open the project.mdf file.
Does anybody have any idea what is going on??
I really appreciate and thank you soooo much for your time !
View 2 Replies
View Related
Jul 25, 2000
I have installed SQL Server 7.0 SP2 on a couple of servers and have been
trying to get the DTS package to run. Unfortunately when I try to create
a new DTS package, I get the foll DTS Designer error:
"Could not create Component Categories Manager"
I've tried using the DTS Import/Export wizard only to keep getting a
Dr Watson error....What am I doing wrong??
Thank you in advance...
Mona
View 6 Replies
View Related
Nov 1, 2007
Actually we have already backed up the Very large database(1.1 TB). We are trying to migrate the backup file to other server . But the copy is running really slow because of slow network banwidth. What are best options to transfer terabyte file from one server to other.
Thanks in advance
View 6 Replies
View Related
Nov 5, 2007
I am restoring 1.2 TB on different server. Can you recommend me the best way to apply that.
View 13 Replies
View Related
Feb 11, 2008
Guys, I really need help with this one.
I am populating the data warehouse and have to deal with some bad sourse databases.
In one table they have 28 columns, used as flags. Each column represents a particular facility. Each record can have 0 to many facilities selected, so this table could have NULL or 'Y' in one or many of those columns. That's a terrible DB design. They should have build a 1-to-many table relationship, but instead, they put everything in one table. And the other funny thing is that those 28 columns are literally named Column1, Column2 ... Column28, and then the actual facility names are HARDCODED in their application codes !!!
So, the table might look like this:
Col1 Col2 Col3 Col4 Col5 .... Col28
--------------------------------------------------
NULL Y NULL NULL Y NULL
Y NULL NULL NULL NULL NULL
NULL Y NULL NULL NULL Y
...........
NULL Y NULL NULL Y Y
My task is to get for each record the first 4 not NULL facility NAMES. I have a script that does that, but this script is very primitive and is huge ! I kind of do 4 runs through this file. First run I get the record ID for each record, and populate the first of the 4 facility names. I am just using CASE statement and check each field if it's NOT NULL then enter the actual hardcoded name. I put all this into a #temp table. The second run I join the main table with this #temp table, again getting the record ID and the first populated Facility Column 1, and then create a Second Facility field, by using the CASE statement again, going through each field, checking for NOT NULL AND NOT being the same as the First Facility name... And so on... Like I said, this is working, but I was just wondering is there is a simpler way of doing this.
Any help or suggestion will be greatly appreciated.
Thanks,
Victor.
View 5 Replies
View Related
Sep 14, 2004
We run a site through asp.net (programmed in visual studio.net) and the site's beginning to get a lot of problems (as the site grows)
Here is the latest error message. I was wondering if someone could help me troubleshoot this.
Server Error in '/' Application.
--------------------------------------------------------------------------------
Transaction (Process ID 145) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
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: Transaction (Process ID 145) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
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: Transaction (Process ID 145) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +723
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) +44
System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
Saltwaterfishing.Components.DB.RankResults.SearchAllSites(String query, Int32 currentPage, Int32 pageSize) in
***************ComponentsDBRankResults.cs:43
***************.Controls.RankResultsGrid.BindDataGrid() in ***************\ControlsRankResultsGrid.ascx.cs:82
***************.Controls.RankResultsGrid.ShowResults() in ***************ControlsRankResultsGrid.ascx.cs:68
***************.Main.ShowPage() in
***************\saltwaterfishingmain.aspx.cs:75
***************.Main.Page_Load(Object sender, EventArgs e) in ***************\main.aspx.cs:43
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Thank you
View 1 Replies
View Related
Apr 5, 2001
What is the process for using sp_attach_db to restore a sql server 2000 database as a sql server 7 database? Article references? Thanks
View 1 Replies
View Related
Apr 10, 2008
I am facing a query problem.i have 2 tables called emp-table and report-table.report table for listing report of employees.
following are criterias..
1 I want list all reports from report-table
2 But no report should have empstatus 5
3 reports need not necessary to have emp-table reference.ie emp-id reference in emp_table.
briefly saying i want all reports from report table,in which no one have empstatus 5
emp-table
empid
empname
empstatus
report-table
repid
empid
details
thanks in advance.
View 4 Replies
View Related
Nov 5, 2007
i need urgent help sorting out my SQl please....
i have 6 tables
Student
class
lectures
student_results
attendance
my case study says " the system should be able to record attendance of student to any class. the system shoul also be able to automatically send out a warning to any student that misses any two lectures for the first time."
can anyone help me solve this problem on SQL (oracle) please...
charles
View 6 Replies
View Related
Dec 19, 2007
Hi,
I am trying to Implement Multi parameter... If i give NULL it works fine but if i give '7,4'
I get this error message
Msg 102, Level 15, State 1, Line 18
Incorrect syntax near '17'.
This is my sproc
Code Block
ALTER Procedure [dbo].[usp_GetOrdersByOrderDate]
@ClientId nvarchar(max)= NULL,
@StartDate datetime,
@EndDate datetime
AS
Declare @SQLTEXT as nvarchar(max)
if @ClientId is null
Begin
Select
o.[OrderId],
o.[OrderDate],
o.[CreatedByUserId],
c.LoginId,
o.[Quantity],
o.[RequiredDeliveryDate],
cp.PlanId,
cp.ClientPlanId,
cp.ClientId
FROM
[Order] o
Inner Join ClientPlan cp on o.PlanId = cp.PlanId and o.CreatedByUserId = cp.UserId
Inner Join ClientUser c on o.CreatedByUserId = c.UserId
WHERE
--cp.ClientId = @ClientId
--AND
o.OrderDate BETWEEN @StartDate AND @EndDate
ORDER BY
o.OrderId DESC
END
ELSE
BEGIN
SELECT @SQLTEXT = 'Select
o.[OrderId],
o.[OrderDate],
o.[CreatedByUserId],
c.LoginId,
o.[Quantity],
o.[RequiredDeliveryDate],
cp.PlanId,
cp.ClientPlanId,
cp.ClientId
FROM
[Order] o
Inner Join ClientPlan cp on o.PlanId = cp.PlanId and o.CreatedByUserId = cp.UserId
Inner Join ClientUser c on o.CreatedByUserId = c.UserId
WHERE
cp.ClientId in (' + @ClientId + ')
AND
o.OrderDate BETWEEN ' + Convert(varchar, @StartDate) + ' AND ' + convert(varchar, @EndDate) + '
ORDER BY
o.OrderId DESC'
execute (@SQLTEXT)
END
any help will be appreciated.
Regards
Karen
View 4 Replies
View Related
Oct 2, 2007
Hi,
I am using this stored procedure to populate a report... if the particular report value is NULL i am getting this error
Cannot read the next data row for the data sest PlanEligiReqattri. Invalid lenght parameter passed to the right function...
This is my stored procedure
Code Block
ALTER Procedure [dbo].[rpt_PlanEligiReqAttriApplied]
@PlanId int
AS
BEGIN
Declare @List varchar(255)
Set @List =' '
Select @List = @List + ', ' + PERA.Name
From PlanEligibilityReqAttriApplied PERAA
Inner Join PlanEligibilityReqAttributes PERA on PERAA.PlanEligibilityReqId = PERA.PlanEligibilityReqId
Where PlanId = @PlanId
select Right(@List, Len(@List) - 2)
--set @List = Right(@List, Len(@List) - 1)
End
any help will be appreciated.
Regards
Karen
View 3 Replies
View Related
Jun 23, 2006
I have an urgent need to solve this issue.
I have a report that has two sets of six sub reports. Here is what I have:
Main Report
Subreport1A
Subreport2A
Subreport3A
Subreport4A
Subreport5A
Subreport6A
Subreport1B
Subreport2B
Subreport3B
Subreport4B
Subreport5B
Subreport6B
I want to have a page break between the first set and the second set. The last subreport of the first set, Subreport6A, has a pagebreak at end = true, so it should break. The problem is that when I export to Excel I am getting one sheet for the 12 subreports.
View 8 Replies
View Related
Oct 25, 2007
Hi i am trying to transfer the contents of a dbf file to sql server 2005 and this is my error message
'C:Documents and SettingsKarenMy DocumentsVisual Studio 2005WebSitesASC1pdfclientAS.DBF' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
This is my code
If (FlAS.PostedFile.FileName.ToLower.EndsWith(".dbf")) Then
FlAS.PostedFile.SaveAs(location)
Try
'Connection string to a dbase file
Dim dbfConnectionString As String = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source ={0};Extended Properties= dBase IV", location)
'create connection to the DBF file
Using connection As Data.OleDb.OleDbConnection = New Data.OleDb.OleDbConnection(dbfConnectionString)
Dim command As Data.OleDb.OleDbCommand = New Data.OleDb.OleDbCommand("Select * from AS.DBF", connection)
connection.Open()
'Create a dbDatareader to the dbf file
Using dr As Data.Common.DbDataReader = command.ExecuteReader()
Dim sqlConnectionString As String = System.Configuration.ConfigurationManager.AppSettings(APPSETTINGS_CONNECTION)
Dim myConnection As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings(APPSETTINGS_CONNECTION))
Dim query As String = "Truncate table ASDBF"
myConnection.Open()
Dim cmd As New SqlCommand(query, myConnection)
cmd.CommandType = CommandType.Text
cmd.ExecuteScalar()
myConnection.Close()
'bulk copy of sql server
Using BulkCopy As SqlBulkCopy = New SqlBulkCopy(sqlConnectionString)
BulkCopy.DestinationTableName = "ASDBF"
BulkCopy.WriteToServer(dr)
End Using
End Using
connection.Close()
End Using
Catch ex As Exception
Throw ex
End Try
End If
Any help will be appreciated.
Regards
Karen
View 12 Replies
View Related
Nov 6, 2007
Hi,
I am trying to insert the Source name and clientId to a table called clientSource...
The User will send in some Dbf File.... So in a particular file called PlanDbf.. I have the following fields
PlanNumber, Name, SRC1Name, SRC2Name, SRC3Name.... SRC20Name
170234 Constructions Employee Deferral Employer Discretionary Employer Matching....
And in another table called SourceDBF i have the following fields with data
PlanNumber PARTID SOURCE_NUM etc...
170234 123456789 1
170234 123456789 3
170234 451231334 1
So how do i match the Source_NUM with SRCnames when i insert it into the table..
INSERT INTO Statement..ClientSource(@ClientId, SourceName)SELECT s.SOURCE_NUM FROM SourceDBF ..
but i am stuck..
any help will be appreciated.
Regards
Karen
View 7 Replies
View Related
Jun 29, 2001
Msg 2503, Level 16, State 1
Table Corrupt: Page Linkage is not consistent; check the following pages: (Current page#=298065; page pointing to this page =286585; previous page# indicated in this page=283321).
Can somebody urgently help? Any help will be appreciated.
View 1 Replies
View Related
Apr 28, 2006
Hi everybody!
I create my database by restore from server’s backup. Every object there is owned by dbo77 user. I want to execute stored procedure in following way: exec sp1 and not – exec dbo77.sp1, when I connect with the same user. I create new Login – dbo77 in Securities folder of my server (LOCAL). And when I connect by this user to that database, I still can’t use syntax: exec sp1.
An error says that my login dbo77 does not have an associated user name. When I try to mark that database in dbo77 ->property->Database_Access it writes an error that dbo77 already exists.
How can I make this db work with syntax exec sp1, if I login with same login name as the owner of sp1?
View 11 Replies
View Related
Dec 22, 1998
Hi every one,
I have a stored procedure which activates a task when ever that sp is called.
and this procedure gets out of the loop.
the task get started running.
Is there any way in Sql server that the same stored procedures should wait until the Task finishes and return a code either 1 or 0 for success or faliure of the task.
Help is greatly appericated
Jeswnath
View 1 Replies
View Related
Feb 16, 2007
I want a stored procedure to run everytime the batch Status field is set to 'Released'
<Code>
CREATE TRIGGER [CSITSS].[tdecker].[FB401BV_TRIGGER] ON [CSITSS].[dbo].[Fbbatch] FOR UPDATE [Status]
AS
DECLARE @RC int
DECLARE @Batch int
SET @Batch = (??? BATCH NUMBER THAT WAS SET TO RELEASE ???)
EXEC @RC = [CSITSS].[tdecker].[GLP_FB401BV_BATCH] @Batch
</Code>
View 9 Replies
View Related
Jun 20, 2008
Seek expert’s advice on database mirroring
in high safety mode when safety is full if for some reason communication between principal and mirror is broken for say 2 days then principal will keep working but in disconnected mode. When communication link will establish again then principal can see the mirror server
1. Will establish the mirroring automatically?
2. Then will it synchronise the mirror databases automatically?
3. If it will synchronise databases automatically then principal will process transaction
or wait till principal-mirror will be in synchronised state which again depends on
number of transaction need to redo on mirror?
Thanks in advance
View 4 Replies
View Related
Jul 20, 2005
Hi all!I am in need of writing a few stored procedures.The first one is to create a stored procedure to recover a databasefrom backup and the second one is to create a stored procedure toexecute a transaction log backup (even though I know this can be donethrough a maintainence plan). Any help would be greatly appreciated.I know the commands to recover and backup -- but I dont know how toformulate them into a stored procedureThanks in advance!
View 1 Replies
View Related
Oct 22, 2007
urgent help needed regarding transactional replication2005
I did set up transactional replication on sql 2005 and also in article properties have selected to replicate foreign keys,default constraints and indexes. I checked the schema properties at publisher and subscriber and found that on one table a foreign key is not replicated which has an on delete cascade. I am not sure why is not replicating that constraint.The other table has a foreign key which is also not replicated.
I would appreciate all your help.
thanks,
Satya
View 3 Replies
View Related
Dec 12, 2007
I have a date "4/25/2007"
but the requirement is to have data as "04/25/2007"
.if month is single digit it should have leading zeroes, same with date,
can some tell me how to convert this.
View 2 Replies
View Related
Nov 6, 2007
Hi pals,
I need small help.
I have a execute SQL task in which i have a delete statement with global params.
delete from <tname> where (strval=?) and (year=?)
both are varchar type variables.
my strval column gets a value something like "DecData1.0". But when i ran my DTS package it is ignoring this SQL statement. Might because of the special char '.' in "DecData1.0".
How to handle such situation.
I also tried by putting a single quote.
delete from <tname> where (strval='?') and (year=?)
But it is giving an error.
Any suggestions will be a great help.
Thanks in advance,
Mahi
View 12 Replies
View Related
Jan 28, 2004
hello to experts :)
I'm stuck and I'm getting an error message
well the following code show access a store precedure ( on MS SQL 7 ) which the sp it self does work fine (using query analizer )
if I use the following code is asp.net I'll get error
BC30451: Name 'CommandType' is not declared.
on
Line 64: objCmd.CommandType = CommandType.StoredProcedure
please, please have look as it is quite urgent.
many thanks in advance
Meghoo
------------------------------------------------------------------------------------
Function non935(ByVal city As String, ByVal feeEar As String, ByVal year As String) As System.Data.DataSet
Dim connectionString As String = "server='csfirm03'; user id='sa'; password='testfirm'; database='ken_live';pooling=false"
Dim mysqlconn As new System.Data.SqlClient.SqlConnection(connectionString)
Dim myDataReader As System.Data.SqlClient.SqlDataReader
Dim SQL As String = "sp_non935"
Dim objCmd As New System.Data.SqlClient.SqlCommand(SQL, mySqlConn)
objCmd.CommandType = CommandType.StoredProcedure
Dim objParam As System.Data.SqlClient.SqlParameter
objParam = objCmd.Parameters.Add("@city", SqlDbType.VarChar)
objParam.Value = @city
objParam = objCmd.Parameters.Add("@trec", SqlDbType.Int)
objParam.Value = @feeEar
objParam = objCmd.Parameters.Add("@year", SqlDbType.VarChar)
objParam.Value = @year
mySqlConn.Open()
myDataReader = objCmd.ExecuteReader(CommandBehavior.CloseConnection)
'Do stuff with the data reader
myDataReader.Close()
mySqlConn.Close()
myDataReader = Nothing
mySqlConn = Nothing
Return dataSet
End Function
Sub year_SelectedIndexChanged(sender As Object, e As EventArgs)
datagrid2.datasource=non935(city.SelectedItem.Value,trec.text,year.SelectedItem.Value)
datagrid2.databind()
End Sub
View 4 Replies
View Related
Jan 19, 2005
How can I use a store procedure in a asp.net. I have been trying many ways but it shows an error : "Invalid attempt to read when no data is present." when I am trying to read the data reader
My store procedure just return one value.
StoreProcedure:
create procedure sp_recordstudent
@studentid integer
as
if exists (select * from tbl_student where int_studentid = @studentid)
select strregistro = 'true'
else
select strregistro = 'false'
go
ASP.net
Dim Conn As New SqlConnection("server='(local)';database='BSF';trusted_connection=true")
Conn.open()
Dim Comm as SqlCommand = Conn.createcommand()
Comm.connection = conn
Dim Trans as SQLTransaction
Dim Query as String = ""
Dim DRStudent as SQLDataReader
'Verify whether the student exists
Query = "execute sp_recordstudent @studentid = " & intSId
Comm = New SQLCommand(query,conn)
'Comm.commandtext =
DRStudent = comm.executereader()
blstudentexist = DRStudent.getstring(o)
DRStudent.close()
View 1 Replies
View Related