How To Access Output (Inserted.ColName) From Client Application ?
Nov 6, 2006
I am using SQL Express 2005 and VB .net Express.
Question 1:
How can I get the result stored in Inserted.ColName (by Output clause of insert command). In the documentation (BOL) for SQL 2005, there is written "returned to the processing application for use" in Output clause (first paragraph).
Question 2:
How to store Inserted.ColName into local variable when insert command is running in stored procedure.:
I'm trying to transfer data from DB2 Database to SQL Server 2005.
Well, i used the OLE DB Source, the Data Conversion Component and the OLE DB Destination component.
I have five Data flows with this configuration above. But I am receiving an error message from one of them.
Please check below the error message:
"[Source Table TARTRATE [1]] Error: The value was too large to fit in the output column "ADJ_RATE_PCT" (60). "
"[Source Table TARTRATE [1]] Error: The "component "Source Table TARTRATE" (1)" failed because error code 0xC02090F8 occurred, and the error row disposition on "output column "ADJ_RATE_PCT" (60)" specifies failure on error. An error occurred on the specified object of the specified component."
I am writing a Windows Application which will be used by about 100 clients. (NT Authenticated)
The application is going to be used in a LAN enviroment. User who have access will download a VB.NET application from a web site.
Of course, I want to prevent any of the 100 users from using a tool such as Query Analysis or ODBC to connect directly to the database and modify data.
So, it appears the way to go is to the "Application Roles". For this to work, the application roll password has to be saved in the application to execute the sp_setapprole procedure.
Is there a way to secure this password? I am worried about a user somehow extracting the password from the application and connecting directly.
Am I on the right track here? Any ideas appreciated!
I have the below procedure with an output parameter '@rowcount'. Now My issue is how to access the value of '@rowcount' in my ASP.Net application using C#. I have also pasted my C# code which I am using . create procedure mypro1(@id varchar(10),@rowcount int output) as select * from canid where id like @id /* @@ROWCOUNT returns the number of rows that are affected by the last statement. */ select @rowcount=@@rowcount -------------------------------------------------- C# code to retrieve the output parameter valuecmd = new SqlCommand("mypro1", cn); cmd.CommandType = CommandType.StoredProcedure;cmd.Parameters.AddWithValue("@id", TextBox1.Text).Direction=ParameterDirection.Input; Parameter cout = new Parameter("@rowcount",SqlDbType.Int);cout.Direction = ParameterDirection.Output; cmd.Parameters.Add(cout); can some body assist me in the above code whether its right or what needs to be added to get the output parameter value.
Hi guys,I'm not sure if I'm just bad at googling but I can't seem to find a way to set an ASP.NET 2.0 web application to connect to SQL Server 2005 using the current client's user credentials. My web application is using Integrated Windows Authentication so its Page.User.Identity is set to a DOMAINusername value... I want to pass that to my connectionstring or have my connections pick up the identity automatically and use that Identity when accessing the db server.Oh and another thing, my IIS Application Pool is using a specific Identity itself, so I don't know if that might affect the above.Hope someone could help.
I have a CLIENTS table with pk CLIENT_ID, and a CONVERSATIONS table where CONV_ID and CLIENT_ID form the pk, there is another column CONVERSATION_DATE where the conversation data is registered (and other columns).
Now I need to retrieve, for each client, the last N (for some clients, eventually, less then N) conversations with one T-SQL statement.
Does anyone knows how to do this? Is it possible with T-SQL only?
I have a SP that inserts data into a table with an identity column I want to get that id and use it in my response.redirect however I keep getting 0 back instead of the identity. Relevent Sql 2005 Declare @NEWEMPID int --after an insert happens in sqlSet @NEWEMPID= SCOPE_IDENTITY()--last thing in my sqlReturn @NEWEMPID Or I tried NEWEMPID as an output parameter VB.Net Dim retValParam As New SqlParameter("@NEWEMPID", SqlDbType.Int) retValParam.Direction = ParameterDirection.ReturnValue'execute the sqldatasource insert command sqlEmpNewEmp.Insert() Dim EmpIDVar As Integer = Convert.ToInt32(retValParam.Value) Response.Redirect("http://www.mysite.com?EMPID=" + Server.HtmlEncode(EmpIDVar)) sqlEmpNewEmp.InsertParameters.Clear()
I'm doing a data migration job from our old to our new database. The idea is that we don't want to clutter our new tables with the id's of the old tables, so we are not going to add a column "old_system_id" in each and every table that needs to be migrated.
I have created a number of tables in a separate schema "dm" (for Data Migration) that will store the link between the old database table and the new database table. Suppose that the id of a migrated record in the old database is 'XRP002-89' and during the insert into the new table the IDENTITY column id gets the value 1, the link table will hold : old_d = 'XRP002-89', new_id = 1, and so on.
I knew I can get the value of IDENTITY columns with the OUTPUT INTO clause, although I have never actually used it. And now I can't get it to do what I need.
Below is some code to set up three tables: the old table, the new one, and the table that will hold the link between the id's of records in the old database table and the new database table.
Below I tried to use the OUTPUT INSERTED INTO clause. Beside getting the generated IDENTITY value, I also need to capture the value of the old id that will not be migrated to the new table. When I use "OUTPUT DaOldTable.pk" the system gives me the error: "The multi-part identifier "DaOldTable.pk" could not be bound." Using INSERTED .id gives no problem.
Code: INSERT INTO DaNewTable(a_column) --OUTPUT DaOldTable.pk, INSERTED.id link_old2new_DaTable--(DaOld_id, DaNew_id) SELECT a_column FROM DaOldTable
[Code] ...
--but getting "The multi-part identifier "DaOldTable.pk" could not be bound."
DROP TABLE DaOldTable DROP TABLE DaNewTable DROP TABLE link_old2new_DaTable
How can I populate a table that must hold the link between the id's of records in the old database table and the new database table? The records are migrated with set-based inserts.
Hi folks, I have an application designed in vb.net and it needs to Communicate with MS SQL 2005 database which resids on SERVER and The applicaton needs to run from Client PCs... When i install the Application on Server itself it works fine.... But when i Install it on any of the client Pcs it gives me the following error....
Unable to install or run the application. The application requires that assembly Microsoft.sqlserver.ConnectionInfo version 9.0.242.0 be installed in Global Assembly Cache (GAC) First.
hie, have a question. what tool is available to develop client/server application with db as ms sql server? is it only visual studio. for example: i was using oracle 9i db with 9i developer as a total package to build applications. very easy with creating update, delete or new forms. is it possible with visual studio or am i missing something? i need to feel comfortable since i know sql server but dont know what to use for developing application. many thanks, farouque
I need to develop fro my customer a WinForm application which will display a list of report name available fro my customer, who will be free to select the desire report to print. For that I was previously using Crystal report but as now I am in an environment where report services is included and can be used I have decide to test it and see if it cover my customer need.
I have use reporting service in one of my customer project but by dircetly accessing it through the ReportServer default interface but never from a WinFrom application.
How can I implemented the connection to reporting service, accessing report template and have access to print function as well as export to different format in my application ?
Is there any step by step procedure somewhere ? could not found
I am currently modifying an existing application (which uses OLE DB Consumer Templates to access a remote SQL db) to utilize SQL Native Client instead. Does anyone have any experience making this change? Am I correct in my assumption that all I have to do is: change my included headers from 'sqloledb.h' to 'sqlncli.h' and change CLSID_SQLOLEDB to CLSID_SQLNCLI? I am still including the 'atldbcli.h' header and therefore still using the OLE DB Consumer Templates. Can I continue to use the Consumer Templates along with SQL Native Client?
i have a oledb destination in my data flow pointing to table ABC and an error output if the insert failed..follow the error output, i have a lookup on table ABC which doesn't seem to work..is it possible to access new data in table ABC follow the error output?
I want to deploy my database application to my client's computer. My application uses SQL Server 2014. My client has to run that software on a single PC. I was looking to download a lightweight version of SQL Server that can fulfill my requirements, so when I was looking for SQL Server downloads, I saw these files there, which file should I use in my situation
ERROR SUMMARY Below is a summary of the errors, details of these errors are listed later in the log. * Activation of http://webdev.ci.lubbock.tx.us/ReportServer$SQL05/ReportBuilder/ReportBuilder.application resulted in exception. Following failure messages were detected: + Downloading http://webdev.ci.lubbock.tx.us/ReportServer$SQL05/ReportBuilder/ReportBuilder.application did not succeed. + The remote server returned an error: (401) Unauthorized.
COMPONENT STORE TRANSACTION FAILURE SUMMARY No transaction error was detected.
WARNINGS There were no warnings during this operation.
OPERATION PROGRESS STATUS * [4/10/2006 11:34:29 AM] : Activation of http://webdev.ci.lubbock.tx.us/ReportServer$SQL05/ReportBuilder/ReportBuilder.application has started.
ERROR DETAILS Following errors were detected during this operation. * [4/10/2006 11:34:29 AM] System.Deployment.Application.DeploymentDownloadException (Unknown subtype) - Downloading http://webdev.ci.lubbock.tx.us/ReportServer$SQL05/ReportBuilder/ReportBuilder.application did not succeed. - Source: System.Deployment - Stack trace: at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next) at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles() at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState) at System.Deployment.Application.DownloadManager.DownloadManifestAsRawFile(Uri& sourceUri, String targetPath, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation) at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation) at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut) at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state) --- Inner Exception --- System.Net.WebException - The remote server returned an error: (401) Unauthorized. - Source: System - Stack trace: at System.Net.HttpWebRequest.GetResponse() at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
COMPONENT STORE TRANSACTION DETAILS No transaction information is available.
Does anyone know how that I can get the reportbuilder.application to run on a client on the network. It seems that if I have to remote into the actual server to get the report builder to work would be pointless for users on the network. I get the 401 Unauthorized all the time. Any comments would help.
We have a small accounting application which is currently based using DBASE database. We need to change the DB and considering SQL Express. However, is some one can clarify following, it would be very helpful:
1) Application is used mostly by standalone non-technical users. There are cases where more than one user will need to connect to DB.
2) We need to ensure that user can not modify database outside of our application. This is needed to ensure database does not get currpted or passwords lost and then no one can open the database.
3) Installation needs to be simple without providing any options to users except where to install database or point to already installed DB in case its a network environment where 2-3 users can be working on the same database.
4) Application is usually installed on normal desktop machines. So, DB should not load the PC heavily.
Please advice if SQL Express is the right direction even with these constraints? What are the other alternatives? We are open to have a small consulting project as well with someone who can guide us through these issues. Email to contact is rkabra101@yahoo.com
i am currently working on designing a database for a bank as a school project for my database class. We have to draw up an entity relationship diagram, Sql tables, database size estimate etc. I am currently working on the security portion of the project. I need to list the groups that have access to my application and use a grid format to show access to specific tables.
I am currently working on designing a database for a bank as a school project for my database class. We have to draw up an entity relationship diagram, Sql tables, database size estimate etc. I am currently working on the security portion of the project. I need to list the groups that have access to my application and use a grid format to show access to specific tables.
Role Loans Payments Transactions Accounts Customer Emplo Database Admin SUID SUID SUID SUID SUID SUID Branch Manager SUI SUI SUI SUI SUI SUI Internal Auditor S S S S S S Loan Officer SUID SUI SUI S S Tellers S S S S SU Customers U
Hi, I have a database working on SQL Server 2005 Standart Edition and i want to create a client windows form aplication. My problem is where to do it? Im trying to use MS visual basic 2005 express edition but it doent support SQL Server 2005 Standart Edition, it only supports SQL 2005 express edition. What should i do ? And in the visual studio 2005 that comes with the package of SQL Server 2005 standart edition there is no project of a winodws form. Please help
I am developing an application that uses Access database (mdb file) to store the user data. The user of this application is not interested in the database file (to view in MS Access Environment). Does the user machine requires MS Access installation to run my application or just some couple of dlls (OleDB driver, Access DB Engine,..) should be enough to run my application?
Hello All I m trying to update a table whose col name will be read from another table. For e.g. Table1 gives the result: 'emp1', 1, 'John' 'emp2', 2, 'Mike' Now in the second table, i need to update the table with Col name = 'Emp1' and then from the second row (above), I need to update Col name= 'Emp2' I need to write one Update Statement which will handle all the cases. I tried Update Table2 set @VariableName = ....... but didnt work... How can i do that ?
I have a procedure where after processing, i am required to send multiple message to calling application.
For ex:
create procedure test as (@a as int, @b as int @c as int ) /* some transformations */ print 'variable a is' + @a; print 'variable b is' + @b; print 'variable c is' + @c;
I am only providing a sample of return messages, but in reality there a lot more messages where a string and a parameter value need to concatenated.Unfortunately print is not allowing to concatenate parameter value.I can use RaiseError, but these messages are not really any error messages.
i tried to concatenate all message and output it using OUT type parameter, but the length of all messages combined exceeds 10000 characters.
Is there any other alternate to send these messages out to application?
SServer PC: Win SBS 2003 with 2.6 GHz processor and 1GB RAMSQL Server 2000 v 2000.8.00.76 (sp3)MS Office 2k3MSJet ms04-014 (latest ost sp8)MDAC v2.8 RTMADO 2.1vb6.exe / ADO 2.0I think this is a SQL Server/ADO problem as I have 2 applications withsame problem.My access database uses a timer based function to insert records intoSQL Server using ADO and stored procedures. Access also uses DAO ,Jet/ odbc to linked tables on SQL Server for many other tasks/forms.All is well when Access 1st run but after a few hours or so the Accessapp grinds to a halt.Upon checking the task manager the mem usuage upto 160MB and handlecount upto 86,000 ! (cpu process % is low).After the "Access Fail" if I stop/start access only, performance isnot returned, I have to stop/start SQL Server.It would seem that allconnections from this PC to SQL server are badly affected, it is nottied to the client application that had the problem.As I could not work out where the problem was I took the Accessfunctionality into a VB6 app, using ADO 2.0, thinking this shouldsimplify matters with Jet and ODBC out of the way.I now have the same problem with the number of handles increasing withevery new timer based function.* code snippet example *If Not OpenConnection Then 'we have not been able to open aconnection to SQL serverCall procLog("Connection failed to SQL server")Exit FunctionEnd If'gVar.cnnSQL is my public ADODB.ConnectionSet cmdSQL = New ADODB.CommandWith cmdSQL.ActiveConnection = gVar.cnnSQL.CommandText = "MyDB.dbo.insert_tblMyData".CommandType = adCmdStoredProc.Execute RecordsAffected:=lngRecs, _Parameters:=Array(lngID, dtDate,intCategory,strNationality,strNotes,strName)End With* code snippet *** After the "Access Fail" if I look at one of my clients, running thesame Access app on another PC, it seems normally responsive when usingone my bound forms to browse the data from same SQL Server **Any ideas anyone ?
Detection of product '{8670F53C-8AD7-4F34-BDBA-17B38A18CB65}', feature 'SQL_SSMSEE' failed during request for component '{6EC5DFBD-F6B5-4F02-8432-BFB8B03562B8}'
Error Description for Event ID - 1004:
Detection of product '{8670F53C-8AD7-4F34-BDBA-17B38A18CB65}', feature 'SQL_SSMSEE', component '{180F515D-F56C-40DD-9D71-CC532EA8E286}' failed. The resource '' does not exist.
While opening our SAP Mobile Client Application, in the task manager MSIEXEC.EXE is running and trying to repair the application and this will cause our application to take time to lauch. In the Event viewer, whenever we try to lauch our application we are getting this event id's. Can you please kindly provide a solution for this msg.
Hi I developed a windows application in Visual studio 2005 and the database is sqlexpress. I wanted my application to run on another system.For that i have installed sqlexpress 2005 on that machine.But that machine doesn't show me any enterprise manager or query manager for sqlserver. Is there any solution for this.
Is there a configuration or a trick to improve the speed of the access to inserted and deleted tables whithin a trigger? Whenever a trigger is called, the access to inserted or deleted constitute approximatly 95% of the execution time.
Is there a way to have access to inserted and to deleted improved other than copying the data to another table?
I have been investigating the number of connections activeinactive to a certain database server and I have stumbled across an application which seems to not be clearing its database connections.For one instance of a client there was >70 sql connections which eventuated from the closing and reopening one 1 screen in the culprut app. Once the application was closed all of the connections are recycled but its evident that within the application itself it is not correctly reusing already existing open connections.
I have raised a point with the main programmer that we need to investigate more into how the application is managingot managing its ADO .NET connections to SQL.
I am starting with doing some reading here URL... and I was hoping to get some more information about the possible impact of excessive sql connections on the SQL Server itself. Our organization is quite lucky in that our SQl Servers are Overspecced given their workload, bearing that in mind I would like to dig a bit deeper to get some stats if I can to highlight the scope of the issue to the managementprogrammers.Our SQL server peaks at 6500 processes and a good 70% of those are due to this applications mis-management of its sql connections.
I need to return a resultset consisting of database errors from SQL Server stored procedure's CATCH CLAUSE but stuck with it. Do I need to use cursors to return resultset and if so, then what is the type declaration for the OUTPUT parameter in my .NET application? I tried 'Object' and 'Variant' but did not work.
I also tried the simple way just using a SELECT statement to return and it works with one stored procedure but not with another as thus in my CATCH CLAUSE:
Code: while (@I <= @count) begin BEGIN TRY -- delete all previous rows inserted in @customerRow for previous counts @I delete from @customerRow -- this is inserting the current row that we want to save in database insert into @customerRow
[Code] .....
This does not work when select is made in the CATCH block, ie it returns no rows to my .NET application:
Code: begin catch IF @@TranCount > 0 or XACT_STATE()= -1 ROLLBACK TRANSACTION; DECLARE @ErrorMessage NVARCHAR(4000); DECLARE @ErrorSeverity INT; DECLARE @ErrorState INT; DECLARE @ErrorLine INT; SELECT @ErrorMessage = ERROR_MESSAGE();
[Code] ....
Just to summarize the code and where the problem is. The code that works uses a SELECT * from temporary table not in the CATCH block and this works while the one that uses the same SELECT * from temporary table inside the CATCH does not return anything! Strange. The Wrong one is used in another Stored procedure from the Right one btw so am wondering why the same code does not work in those two different situations.
And works perfectly, but ... how to make sure every item has an element "nodes" ? The case here is for the child leafs obviously. This, because on the client i have to inject this element "nodes" on a json version of this xml, and just wanted to avoid normalizing the structure on the client.
For the root I am using
FOR XML PATH('root'),TYPE; and for the hierarchy that follows FOR XML RAW ('node'), root('nodes'), ELEMENTS
I've developed an application that connects to a SQL Server 2005 Express database. I created a DSN to connect to the database through ODBC. Currently, I am testing locally and everything works fine.
I would now like to install my application on another workstation and connect remotely to the database located on my development machine.
The client workstation does not have SQL Server 2005 Express installed on it because I would just like my application to connect remotely by creating the DSN and using ODBC. What I'm missing here are the database drivers. The "SQL Natice Client" is not available on this client workstation. How can I deploy the necessary drivers with my installation file so that I may create the required DSN name using the SQL Native Client driver?
I'm a newbie have trouble using the "inserted" table in a trigger. When I run these SQL statements:CREATE DATABASE foobarGOUSE foobar GOCREATE TABLE foo ( fooID int IDENTITY (1, 1) NOT NULL, lastUpdated datetime, lastValue int, PRIMARY KEY(fooID))GOCREATE TABLE bar ( barID int IDENTITY (1, 1) NOT NULL, fooID int NOT NULL, [value] int NOT NULL, updated datetime NOT NULL DEFAULT (getdate()), primary key(barID), foreign key(fooID) references foo (fooID))GOCREATE TRIGGER onInsertBarUpdateFoo ON Bar FOR INSERTAS UPDATE Foo SET lastUpdated = inserted.updated, lastValue = inserted.[Value] WHERE foo.fooID = inserted.fooIDGO
I get the error message:
Msg 4104, Level 16, State 1, Procedure onInsertBarUpdateFoo, Line 4 The multi-part identifier "inserted.fooID" could not be bound.
I can get the trigger to work fine as long as I don't reference "inserted".
What am I missing?
I'm using Microsoft SQL Server Management Studio Express 9.00.2047.00 and SQL Express 9.0.1399