When I run the stored procedure sp_monitor through VB I only
seem to be able to access the first 3 values returned, see code below. When I run the stored procedure through the enterprise manager I can see about 13 returned values. The reader loop only seems to have one iteration, with 3 arguments, how do I access the others?
When I create a tableadapter to do an insert it added SELECT EventDate, EventID, org_id, ROMEventID FROM ROMEvents WHERE (ROMEventID = SCOPE_IDENTITY()) at the end. This looks useful to me since it implies that I can access ROMEventID which is the auto-incremented identity field. How would I reference the variable in my .cs file? My insert is working as ROMEventsTableAdapter ROMEventInsert = new ROMEventsTableAdapter(); ROMEventInsert.InsertIntoROMEvents(theDate, EventID, org_id); Thanks for any help
After running sp_monitor I got the follwoing errors, I have runned sp_dboption and also SET ANSI_Warning to OFF. The problem is still there therefore, I would be very glad if someone out there can help me out me.
Error Messages Server: Msg 8115, Level 16, State 2, Procedure sp_monitor, Line 94 Arithmetic overflow error converting expression to data type int.
Can I use sqlDatareader with a stored procedure to return more than one reultset that I ll be accessing through MyDatareader.MoveNext Any Little example on both the stored proc and the .Net side Thanks
This happens only on multiprocessor machines. SQL Service pack 3. The only way to fix it is to restart the SQL service. If you have a performance tool based on that value, like Idera's SQLdm- sorry, it will show zero.
I have a package that I have been attempting to return a error code after the stored procedure executes, otherwise the package works great.
I call the stored procedure from a Execute SQL Task (execute Marketing_extract_history_load_test ?, ? OUTPUT) The sql task rowset is set to NONE. It is a OLEB connection.
I have two parameters mapped:
tablename input varchar 0 (this variable is set earlier in a foreach loop) ADO. returnvalue output long 1
I set the breakpoint and see the values change, but I have a OnFailure conditon set if it returns a failure. The failure is ignored and the package completes. No quite what I wanted.
The first part of the sp is below and I set the value @i and return.
Why is it not capturing and setting the error and execute my OnFailure code? I have tried setting one of my parameter mappings to returnvalue with no success.
This is my function, it returns SQLDataReader to DATALIST control. How to return page number with the SQLDataReader set ? sql server 2005, asp.net 2.0
Function get_all_events() As SqlDataReader Dim myConnection As New SqlConnection(ConfigurationManager.AppSettings("...........")) Dim myCommand As New SqlCommand("EVENTS_LIST_BY_REGION_ALL", myConnection) myCommand.CommandType = CommandType.StoredProcedure
Dim parameterState As New SqlParameter("@State", SqlDbType.VarChar, 2) parameterState.Value = Request.Params("State") myCommand.Parameters.Add(parameterState)
Dim parameterPagesize As New SqlParameter("@pagesize", SqlDbType.Int, 4) parameterPagesize.Value = 20 myCommand.Parameters.Add(parameterPagesize)
Dim parameterPagenum As New SqlParameter("@pageNum", SqlDbType.Int, 4) parameterPagenum.Value = pn1.SelectedPage myCommand.Parameters.Add(parameterPagenum)
Dim parameterPageCount As New SqlParameter("@pagecount", SqlDbType.Int, 4) parameterPageCount.Direction = ParameterDirection.ReturnValue myCommand.Parameters.Add(parameterPageCount)
myConnection.Open() 'myCommand.ExecuteReader(CommandBehavior.CloseConnection) 'pages = CType(myCommand.Parameters("@pagecount").Value, Integer) Return myCommand.ExecuteReader(CommandBehavior.CloseConnection) End Function
Variable Pages is global integer.
This is what i am calling DataList1.DataSource = get_all_events() DataList1.DataBind()
How to return records and also the return value of pagecount ? i tried many options, nothing work. Please help !!. I am struck
I'm trying to create a report that's based on a SQL-2005 Stored Procedure.
I added the Report Designer, a Report dataset ( based on a shared datasource).
When I try to build the project in BIDS, I get an error. The error occurs three times, once for each parameter on the stored procedure.
I'll only reproduce one instance of the error for the sake of brevity.
[rsCompilerErrorInExpression] The Value expression for the query parameter 'UserID' contains an error : [BC30654] 'Return' statement in a Function, Get, or Operator must return a value.
I've searched on this error and it looks like it's a Visual Basic error :
I am trying to bring my stored proc's into the 21st century with try catch and the output clause. In the past I have returned info like the new timestamp, the new identity (if an insert sproc), username with output params and a return value as well. I have checked if error is a concurrency violation(I check if @@rowcount is 0 and if so my return value is a special number.)
I have used the old goto method for trapping errors committing or rolling back the transaction.
Now I want to use the try,catch with transactions. This is easy enough but how do I do what I had done before?
I get an error returning the new timestamp in the Output clause (tstamp is my timestamp field -- so I am using inserted.tstamp).
Plus how do I check for concerrency error. Is it the same as before and if so would the check of @@rowcount be in the catch section?
So how to return timestamp and a return value and how to check for concurrency all in the try/catch.
by the way I read that you could not return an identity in the output clause but I had no problem.
i have using BCP to output SP return data into txt file, however, when it return nothing , it give SQLException like "no rows affected" , i have try to find out the solution , which include put "SET NOCOUNT ON" command before select statement, but it doesn't help :(
anyone know how to handle the problem when SP return no data ?
I have a stored procedure that selects the unique Name of an item from one table.Â
SELECT DISTINCT ChainName from Chains
For each ChainName, there exists 0 or more StoreNames in the Stores. I want to return the result of this select as the second field in each row of the result set.
SELECT DISTINCT StoreName FROM Stores WHERE Stores.ChainName = ChainName
Each row of the result set returned by the stored procedure would contain:
ChainName, Array of StoreNames (or comma separated strings or whatever)
I am wondering if anyone can help me/ Currently I have created an ASP.NET webform. Usingt the VS.NET C# IDE I have put a SQL connection and DataAdapter on the webform. I have then created a dataset which should hold the contents of a table on a SQL server db.
However when i run the page which just tries to fill the dataset i get the error below. I am running the page via IIS on WinXP Pro SP1 system and SQL Server is located on a Win2003 Svr.
Can anyone help?
Thanks & Regards,
Alan
Server Error in '/Quiz' Application. --------------------------------------------------------------------------------
SQL Server does not exist or access denied. 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: SQL Server does not exist or access denied.
Source Error:
Line 38: // Put user code to initialize the page here Line 39: Line 40: sqlConsumerDataAdapter.Fill(consumerDS11); Line 41:
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
I have two assets: a URL that points to an XML file, and a stored procedure that can accept this file as a text variable and store it in a SQL 2005 table. create procedure [dbo].[insertObjects] @availabilityXml text as DECLARE @xmlHndAdd INT EXEC sp_xml_prepareDocument @xmlHndAdd OUTPUT, @availabilityXml TRUNCATE TABLE Objects INSERT Objects SELECT * FROM OPENXML(@xmlHndAdd, '//NewDataSet/Table1', 2) WITH Objects
Now, I need to find a solution to combine the URL with the proc. Does anyone have any suggestions on how I can pass my URL as a text variable to the procedure? SSIS, vb-script, etc. are welcome!
I am trying to execute an SSIS package (which accesses a dbf file through an odbc connection) through a Sql job, but the package log reports an error of "Disk or netowrk error". When I execute the package in the IDE, the package executes fine. When I run the manifest on the DB server, I can execute the package with no errors. But, when I create the job, and try to execute the job, it fails. I thought at first that the user didn't have privileges to the directory that the file existed in, but that isn't the case.
Can anyone shed some light on how to accomplish what I am trying to accomplish? It seems like this would be a common use of SSIS, but I cannot seem to get it to work.
Thanks in advance for any assistance you can provide!
Hi, I am developing a small asp.net application where I read from a readonly omnis database via odbc then dependant on user input write records to a second database.My first idea was to use an odbc connection to Omnis database and write to ms sql database. There is quite a few queries that need to be made to the Omnis database and I am binding a datagrid to the MS Sql server database. I was hoping to use stored procedures to update the mssql tables. So there will be much opening and closing of connections. Should I go down that road or should i think of using an Access database, with linked table to the Omnis database, then only one connection needs to be made. And I can store my information in the Access database tables. Thanks.
Hello,I just uploaded a new SQL database to my hosting server.I am using SQL 2005 and SQL Server Management Studio.How can I remotely access the SQL database, on my hosting server, to create or alter tables and queries, using SQL Server Management Studio? Thank You,Miguel
I have a SqlDataSource that returns a list of companies and their details by ProductID. It also returns the name of the product associated with the ProductID as the final column (which means it appears for every record returned). I already have a way of determining how many rows were returned, and use that information in a label to say "Your search has returned x records". protected void dsGetSuppliersByProduct_Selected(object sender, SqlDataSourceStatusEventArgs e) { int RecordCount = e.AffectedRows; if (RecordCount == 0) { lblRecordCount.Text = "<p>No Records found"; } else { if (RecordCount == 1) { lblRecordCount.Text = "<p>Your search returned 1 record"; } else { lblRecordCount.Text = "<p>Your search returned " + RecordCount + " records"; } } string ProductName; }How can I access the ProductName value so that I can extend the label text to say "Your search has returned x records for <ProductName>" ?
Hey All I wish to display the 3rd and 4th to last records of a table on a page. Is there anyway of doing this? I can access the last records by using Count and TOP 1 but i find that count - 1 as the ID to select can be errornous if records are removed from the table. I also tried using ORBER BY followed by LIMIT but kept getting an error in order by clause message. Any help would be greatly appreciated Thanks and Regards Drew
Hi all, I am experiencing the following error when I try to access a T-SQL UDF from within a SQL statement that I execute from a CLR UDF.Msg 6522, Level 16, State 1, Line 2 A .NET Framework error occurred during execution of user-defined routine or aggregate "HelloWorldCLR": System.Data.SqlClient.SqlException: This statement has attempted to access data whose access is restricted by the assembly. System.Data.SqlClient.SqlException: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnectionSmi.EventSink.DispatchMessages(Boolean ignoreNonFatalMessages) at Microsoft.SqlServer.Server.SmiEventSink_Default.DispatchMessages(Boolean ignoreNonFatalMessages) at Microsoft.SqlServer.Server.SmiEventSink_Default.DispatchMessages(Boolean ignoreNonFatalMessages) at System.Data.SqlClient.SqlDataReaderSmi.InternalNextResult(Boolean ignoreNonFatalMessages) at System.Data.SqlClient.SqlDataReaderSmi.NextResult() at System.Data.SqlClient.SqlCommand.RunExecuteReaderSmi(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteScalar() at UserDefinedFunctions.HelloWorldCLR()I have tried the SQL BOL and Google with no luck. Here is the sample code I am using to produce this error: HelloWorldUDF.sqlIF OBJECT_ID (N'dbo.HelloWorldUDF') IS NOT NULL DROP FUNCTION dbo.HelloWorldUDF GO
CREATE FUNCTION dbo.HelloWorldUDF() RETURNS varchar(100) AS BEGIN RETURN 'Hello World'
END GOHelloWorldCLR.cs using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server;
public partial class UserDefinedFunctions { [Microsoft.SqlServer.Server.SqlFunction( DataAccess = DataAccessKind.Read )] public static SqlString HelloWorldCLR() { using ( SqlConnection conn = new SqlConnection( "context connection=true" ) ) { conn.Open();
SqlCommand command = new SqlCommand( "SELECT dbo.HelloWorldUDF()", conn ); return new SqlString( command.ExecuteScalar().ToString() ); } } };
Test query: select dbo.HelloWorldUDF() select dbo.HelloWorldCLR() Could some one please confirm that this should be possible or not? Thanks! Joe.
If my site is hosted with an external company web host can I use ASP.NET pages to connect to a MS SQL DB that is on my company's internal server if I had MS SQL installed on it?
My company's server is always on and always connected to the internet.
I have access to my company's server if I need to set anything up on it for this to happen.
There will not be any kind of overload as the site is not accessed constantly.
Also, would this cause any kind of security leak? If so how would I go about plugging this hole?
I'm using OLEDB in my ASP code to connect to the SQL database. When I execute the page I got an error saying "438, Microsoft VBScript runtime error, Object doesn't support this property or method" Anybody knows what this is in reference to. I tested the same site in another server where IIS and SQL are in the same box and it's working fine.
I need to write a VB app (VB6) to access and manipulate data within a MS SQL Sever 2000 database. I have experience doing this with MS Access. Is it much different/more difficult to do this with SQL Server?
Can I connect to the MS SQL database from the Redhat Linux 9. Is there MS SQL client or database driver on linux available. I wanted to use the data from the MS SQL database in the C++ program running on Linux.
Can someone let me know how I can have a look at the transaction log in SQL server. I'd like to find out what INSERT, UPDATE, DELETE commands have been executed on a table today, yesterday etc.
I'm new to databases as you probably can tell. A friend sent me three data bases, which in my mind should have been one database with all the tables included, but he didn't. So my question is, can you pull info from two databases in the same query?
I write the query acessing one database and the result chart must depend on a where predicate based on accessing tables in another database. If this isn't possible, how do I get the tables I need together, that presently reside in differing databases?
We are planning to migrate an application written in Perl + mySQL to .NET + MS-SQL Server. The test machine now has SQL Server running. During the development phase in .NET, we would want to access the mySQL database which is being updated at real time, from the Windows box. This is how I think it has to be done:
1. Use DTS to migrate data from mySQL. Does DTS take care of migrating schema and the difference in data types between the mySQL and MS-SQL? Is there any 3rd party software out there that takes care of the migration without any manual labor?
2. Synchronize the data between 2 DBs by creating some kind of a batch job? If so, whats the best way of doing this?
Instead, is it easier to access the live mySQL database on the Linux box from the .NET code and move the DB only after development in the new environment is completed?
-Let the windows account be the login on the SQL server. This is not a problem.
1.But I also want to use the windows login as authentication method for the webpage. The users have to explicitly log-in. 2.Is it a problem to retrieve all users within a windows domain?
I have to troubleshoot a problem with a complex sproc that is running against a number of views that select entire tables from another "production" database. The problem we are having is that while the views should be read-only, there are no transactions, and no locking, the application's process on SQL Server is blocking anyone else who tries to write data. I'm wondering if this method of using a view as a proxy to another DB is effecting the block. The reason for doing this was to improve performance by offloading the production DB, but since it's the same instance of SQL Server, does it really matter? THX for your advice.
Hello everybody. I'm having a problem: As the result of Dataflow task I get a recordset with about 50 columns in it. Now I need to loop through each row in the dataset and make some manipulations with the data in all 50 columns in a single script task. So I need 'em as separate variables. Ofcourse I can make a For Each Loop container with ADO enumerator, and map each column to specific variable. But that's not a very good thing, because if the format changes, i will have to remap everything again (takes a lot of time to remap 50 values)
So is it possible: 1. To map using not index of columns, but there names? 2. To pass actual row into the script task?