Determine Which User Has Locked A Record

Jul 23, 2005

I'm trying to determine which user has locked a given record from VB6.

I know I can use sp_lock and sp_who, and match up the data to determine
which users have locked records in my database, however I haven't seen a way
to match the specific user to the specific record. What am I missing here?

Thanks!

*David*

View 5 Replies


ADVERTISEMENT

Column Locked In Record Even Though No One Accessing Record

Mar 18, 2008



Hello. I have a database with a record that has two columns locked. descrip1 and descrip2. they are both nvarchar(max) columns. These are the only two columns of the record that remain locked. I am certain no user is accessing the record. I have even moved a backup of the database to my testing computer and the lock still exists. How do I remove the lock from these two columns on that particular record.

I can edit these two columns on other records. I have researched "Unlock" on MSDN but it doesn't seem to apply to t-sql. Any help would be greatly appreciated.

Thanks. Gary.

View 4 Replies View Related

How Do We Determine Which User Database Tables Are Mostly Retrieved By User Or Modified By User?

May 22, 2008



Hi,
Please give the T-SQL script for this ? Thanks

Shanth


View 4 Replies View Related

Run Time Error 3197 - Record Locked

Oct 4, 2000

Hi Fellow Listers:

Working with SQL 7 and Visual Basic 5.0:
We have experienced a lock situation and we do not know how it happened nor how to solve it:

When trying to update a record we get the following message.

Run time Error 3197:
The Microsoft Jet Database engine stopped the process because you and another user are attempting to change the same data at the same time.

And for sure, ONLY one user is connected at the time.
Apparently, the record is marked and can be read but CAN NOT be updated.
Fortunately the record CAN be deleted !!!

The only way we found was using the VISDATA.exe that comes with Vbasic, to delete the record and add a new record with the same information.

Since this condition makes any updating program to be aborted, it's a big problem.
How this happened?
Is there any way to prevent this?
Is there a way to detect this in advance?
Is there a way to correct this situation automatically, such as rebuild or check the Data Base?

Your advise will be greatly appretiated

TIA
Gerardo Alvarez
asaca@asaven.com
asaca@telcel.net.ve
Bienvenido a nuestro Site en http://www.asaven.com

View 1 Replies View Related

ODBC Call Fail/Record Locked

May 3, 2004

I have recently moved some native Access tables to SQL Server 7. These tables are updated in code. When the update is done via a SQL statement, I get
"This record is being modified by another user. . . Save, Copy to Clipboard, Drop Changes"

When the record is being updated via DAO code, I get,
"ODBC Call Fail"

Both errors are most irritating and I desperately need to find a way around this. Any suggestions would be greatly appreciated.

Crystal

View 1 Replies View Related

User 'sa' Is Locked Out

Sep 6, 2006

I just brought SQL Server 2005 up on Windows Server 2003 a few days ago. Everything was going great up until a few minutes ago. I tried to connect using the Management Console and get the message

Login failed for user 'sa' because the account is currently locked out. Your administrator can unlock it.

It's the administrator that's locked out!

Do I have to reinstall SQL Server all over again?

View 2 Replies View Related

SQL 2012 :: Identifying User With Row Locked

Feb 3, 2015

Is there a way to identify what user has a locked row in a table?

View 2 Replies View Related

TRUNCATE TABLE In A Sproc W/locked-down User

Sep 18, 2006

Hullo folks, I'm having what I assume is a fairly mundane security issue.

I have a SQL login that I am trying to restrict as much as possible. This account's sole goal in life is to hit the server, return some usage statistics, then truncate the table it received the statistics from. I would like to refrain from granting this login permissions on the physical target table if possible.

Usually I can wrap up "protected" operations in a stored procedure, then grant exec permissions for my user and I'm good to go. However, TRUNCATE TABLE gets cranky with me when I attempt the above method. I suspect that has to do with the fact that TRUNCATE TABLE is effectively modifying the table itself as opposed to merely deleting data.

Is it possible to grant this login ONLY execute permission on a stored proc that TRUNCATE's tables without giving the user any physical permissions? Am I going about this the wrong way?

View 7 Replies View Related

SQL 2000 Locked In Single User Mode

Oct 20, 2006

I have gotten my production version of SQL locked into single user mode. We recently upgraded to a clustered configeration and when I went to pause the system to get control I was told Pause was not available in a clustered environment. I restarted the service with -m [single user] but couldn't run Enterprise Manager as it appeared to take the only user slot and not give me one. Then I hit on startingup with Query Analyzer and that worked but now how do I get it back into multi-user mode. I placed the -m in the settings using Enterprise manager; could I stop the service and restart at the cmd prompt using -f [minimal config] and get Enterprise manager running? Any assistance appreciated.

View 4 Replies View Related

How To Determine If A Record Is Not Sync'd

Aug 10, 2007

Hello.


I'm not sure if this is possible, but I was hoping to get an answer
here. I'm creating a Windows Mobile 5.0 Smartphone program which
uses SqlCeResultSets as its data objects.





I was wondering if there is
anyway to easily tell if there are records which have been inserted
into the local DB but have not been sync'd up to the publisher yet.





I use merge replication to sync the device with the host and I know
that the merge replicator obviously can tell the difference. Is there
any special field or flag that I can check to see if the record is
only local, on the subscriber side??









Thanks!
SMP

View 1 Replies View Related

Determine When A New Record Is Added To A Database

Dec 31, 2007

I have a SQL database that gets populated by another program. Is there a way to determine when a new record is added to that database?

Thanks

View 4 Replies View Related

MSSQL Server 2005 Reported Account Locked Out For User 'sa'

Nov 29, 2006

Greetings,

I receive an error message in event log when i try to connect to the Database Server using ODBC on a client machine. The database server is running on Windows 2003 Server Standard Edition and the client machine is Windows XP Professional. Following is the error message from the event log:

2147467259 - [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sa' because the account is currently locked out. The system administrator can unlock it.

What causes the error to occur and how to resolve it?Appreciate for your assistence.

Thanks and regards,

Viknes

View 4 Replies View Related

How To Determine Which Record Was Updated Using A Update Trigger?

May 8, 2008



Im using a trigger to check updates on particular table and execute a email. it works but it doesnt show the right record
im looking into one table called SiteInfo.
here is my code
Im using sql 2005, can someone look at my code or the select statement.


SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- Author: <Author,,Name>

-- Create date: <Create Date,,>

-- Description: <Description,,>

-- =============================================

CREATE TRIGGER TTSUpdate

ON SiteInfo

FOR UPDATE

AS

declare @SiteID varchar(10)

declare @Body2 varchar(2000)

declare @Sitename varchar(50)

declare @TTSCreate varchar(30)

declare @TTSCreator varchar(50)

declare @Subject2 varchar (100)



SELECT @SiteID = SiteID,@Sitename = AccountName,@TTSCreator = TTSOwner,@TTSCreate = TTSCreatedDate

from SiteInfo



SET @Body2 = 'New TTS site created: ' + @Sitename + ' With TTS Site ID:' + @SiteID + ' TTS was created on: ' + @TTSCreate + ' By:' + @TTSCreator

SET @subject2 = 'New TTS site created: ' + @Sitename

EXEC msdb.dbo.sp_send_dbmail

@profile_name = 'TTSAdmin',

@recipients = 'email address here',

@subject = @subject2,

@body = @body2

GO

View 3 Replies View Related

How To Determine Login Name From User

Apr 13, 1999

How do I determine the Login name from the user name, in SQL?

For example, I have a Login called Accounting with users Bob and Sue. How do I know from Bob or Sue's user name that they are members of the Accounting Login?

I am using NT Authentication.

Thanks!

View 2 Replies View Related

Determine User Assigned Rights To Public Role

Oct 10, 2007

Hi:

When I restore DB from testing to production, we want to remove extra access rights granted to public group. Is there a simple way to query to find out for which objects (table, view, sp, fn) that public group were granted select, delete, update insert, or execute rights?

My objective is to write a sp to remove all user assigned rights to public group (role), but not to deny any rights. How to do it?


Any suggestion will be appreciated.

View 1 Replies View Related

How To Determine If The Logged On User Is A Member Of An Active Directory Security Group?

Aug 7, 2007



We are using Windows authenication within our system, and I was wondering how it would be possible to determine if the user conected to the SQL SERVER instance was a member of a particular active directory security group?

Thanks.

View 3 Replies View Related

How To: Determine If Current Windows User Has Login Access, Database Access And If They Are A Member Of A Specific DB Role.

Mar 25, 2008


I need to determine the following about the current authenticated Windows domain user who is trying to access a SQL Server via a trusted connection.

1 Has the current user been granted login access to the trusted SQL Server?

2 Has the current user been granted access to a specific database?

3 Is the current user a member of a specific database role such as (DB_ROLE_ADMINISTRATORS)?

Thanks,
Sean

View 6 Replies View Related

User Functions - Getting First Record

Sep 8, 2004

Here is my problem - I have a user defined function that needs the FIRST value from a specially sorted result set. When I do my set statement I get the LAST value in my result set. I can't figure out how in a SQL function to only get that first value (since I can't do a cursor or temp table).

Example: My table has a keyid (created by identity value, the value I need)
Also it has a vendorid, a repid, and an inventoryid. These tie out to other tables.

If I sort my result set in a certain descending order, the first record's keyid is the value I need. Problem is that I am getting the last keyid instead of the first. I can't switch my sort though and get the right value, because of some well-placed zeros. Hard to explain.

I guess what I want is something like:

Select @keyid = FIRST keyid from sortedtable order by vendorid desc, inventoryid desc, repid asc


It's the select FIRST that hangs me up. Can't find that function - does it or something like it exist that I can use from within my function? I'm sure it can be done, I'm just sure I don't know how... Thanks for your help. - K

View 4 Replies View Related

Error - Record Has Been Changed By Another User

Mar 3, 2005

I apologize in advance if this has been posted but if you get the attached error "The record has been changed by another user...", we've discovered that this error can occur if you have a SQL Server Data Type of "Float" and also a "Text" Data Type in the same table. We discovered that it only happens on some records though and I am not sure why this is so. The solution is apparently to add a TimeStamp Data Type to the SQL Server table which does seem to fix the problem. If anyone has any insight on any other solutions (we cannot change the Data Types) or the reasoning behind this error, I would greatly appreciate the feedback.

View 4 Replies View Related

How To Add Record With Same Primarykey That User Deleted

Feb 28, 2007

I have a sql server database that she deleted a record with ID as 2873. I would like to try to add this record manually, but the primary key can't be edit. How can i add this record with the same ID as she deleted?

Many thanks.

View 1 Replies View Related

Get Only One Record Out Of X Number Of Records Per User ID

Oct 29, 2013

I need to create a query that will select only one record out of x number of record per user id.

Sample Data
User ID | Date |Status
001 |10/1/2013 |01
001 |10/2/2013 |A1
002 |1/1/2013 |BB
003 |5/8/2013 |EE
003 |4/2/2013 |BB

Expected Result
User ID | Date |Status
001 | 10/2/2013 |A1
002 | 1/1/2013 |BB
003 | 5/8/2013 |EE

View 3 Replies View Related

Display Last Updated Record By A User

Mar 30, 2008

I would like to show when leads updated last their records in database. An automated report that tells me when the last date was that the leads updated an entry, only 1 entry per lead.

select Lead,LastUpdated from dbo.KPITbl

I have a table with data that looks like this:

Lead LastUpdated
----------- -----------------------
JOHN SMITH 2008-03-26 08:45:00
JOHN SMITH 2008-03-20 09:33:00
MEG RYAN 2008-02-21 16:16:00
JOHN SMITH 2008-02-21 16:19:00
MEG RYAN 2008-02-21 16:22:00
JOHN SMITH 2008-03-28 16:10:00
JOHN SMITH 2008-03-28 08:49:00
JOHN SMITH 2008-03-23 19:23:00
MARK MCRAE 2008-03-27 03:12:00
MARK MCRAE 2008-03-26 08:48:00
MARK MCRAE 2008-03-26 08:46:00
JOHN SMITH 2008-03-26 08:47:00
JOHN SMITH 2008-03-26 08:48:00
ALLAN WHITE 2008-03-26 08:43:00
ALLAN WHITE 2008-03-26 08:40:00
JOHN SMITH 2008-03-26 08:48:00


Thank you appreciate it.

View 2 Replies View Related

Inserting A New Record Into Sql Db Using User-entered Information

Nov 22, 2006

Im trying to add a new rcord to my db on a button click usign the following code
 
'data adapter
Dim dAdapt1 As New SqlClient.SqlDataAdapter
'create a command object
Dim objCommand As New SqlClient.SqlCommand
'command builder
Dim builderT As SqlClient.SqlCommandBuilder
'connection string
Dim cnStr As String = "Data Source=ELEARN-FRM-BETA;Initial Catalog=StudentPlayGround;Integrated Security=True"
'dataset
Dim dsT As DataSet
Private Sub connect()
'connection
objCommand.Connection = New SqlClient.SqlConnection(cnStr)
'associating the builder with the data adapter
builderT = New SqlClient.SqlCommandBuilder(dAdapt1)
'opening the connection
objCommand.Connection.Open()
'query string
Dim query As String = "SELECT * from StudentPlayground..Employees"
'setting the select command
dAdapt1.SelectCommand = New SqlClient.SqlCommand(query, objCommand.Connection)
'dataset
dsT = New DataSet("Trainee Listings")
dAdapt1.Fill(dsT, "Employees")
End Sub
Private Sub BindData()
connect()
DataBind()
End Sub
Protected Sub submitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submitButton.Click
Dim empID As Integer = CType(FindControl("TextBox8"), TextBox).Text
BindData()
Dim firstName As String = CType(FindControl("TextBox1"), TextBox).Text
BindData()
Dim lastName As String = CType(FindControl("TextBox2"), TextBox).Text
BindData()
Dim location As String = CType(FindControl("TextBox3"), TextBox).Text
BindData()
Dim termDate As Date = CType(FindControl("TextBox4"), TextBox).Text
BindData()
Dim hireDate As Date = CType(FindControl("TextBox7"), TextBox).Text
BindData()
Dim dept As String = CType(FindControl("TextBox5"), TextBox).Text
BindData()
Dim super As String = CType(FindControl("TextBox6"), TextBox).Text
BindData()
Dim newRow As DataRow = dsT.Tables("Employees").NewRow
newRow.BeginEdit()
newRow.Item(0) = empID
newRow.Item(1) = firstName
newRow.Item(2) = lastName
newRow.Item(3) = location
newRow.Item(4) = hireDate
newRow.Item(5) = termDate
newRow.Item(6) = dept
newRow.Item(7) = super
newRow.EndEdit()
 
'do the update
Dim insertStr As String = "INSERT INTO Employees" + _
"(EmployeeID,FirstName,LatName,Location,HireDate,TerminationDate,Supervisor)" + _
"VALUES (empID,firstName,lastName,location,hireDate,termDate,dept,super)"
Dim insertCmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(insertStr, objCommand.Connection)
dAdapt1.InsertCommand() = insertCmd
 
dAdapt1.Update(dsT, "Employees")
'Dim insertCmd As new SqlClient.SqlCommand = (builderT.GetInsertCommand()).ToString())
'dAdapt1.InsertCommand = New SqlClient.SqlCommand(insertCmd.ToString(), objCommand.Connection)
BindData()
objCommand.Connection.Close()
objCommand.Connection.Dispose()
End Sub
 
im not sure wats going wrong because the record is not being added. Please help!!

View 4 Replies View Related

This Record Has Been Changed By Another User Since You Started Editing It....

Jul 9, 2002

I am getting the following error while trying to update a SQL Server 7.0 table thru' MS Access('97 version). It was working fine until now. This problem started happening after re-linking the table to MS Access as new columns have been added on the SQL Server table. We tried re-starting the MS Access,re-linking the table again,giving all the permissions to the user on the table etc. Also, no other user is accessing the table at the same time..Any help?

Error message in MS Access:

This record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes the other user made.

Copying the changes to the clipboard will let you look at the values the other user entered, and then paste your changes back in if you decide to make changes.

thanks,
Mike.

View 1 Replies View Related

Odbc Error - Record Has Been Changed By Another User

Oct 9, 2001

The following error is recieved when updating a record using access 97 and odbc driver to an oracle database.

This record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes the other user made.

Any help is greatly appriciated.
Thanks in Advance

View 1 Replies View Related

Insert Automatically Many Record For User Defined Range

Jul 11, 2012

I want insert automatically records for Range that user definded

For example user define :

from to city
10000 12000 tehran
15000 19000 babol

I should inserted 2000 record for tehran (10000,10001,....,12000) and 4000 record for babol (15000,15001,...,19000)

View 3 Replies View Related

Web Based Sql Server Record Manipulation In Multi-user Environment

Jan 20, 2007

I was wondering if you guys might give me some advice on how best to handle a particular scenario i'm struggling with.
I have a client that basically wants web-based-update access to their sql server database.  Specifically, for a group of users to be able to access a page where they select a record for editing.  the caveat is that no two users should be able to pull up the same record at the same time.  Originally I would have thought there was some easier record-locking-mechanism I could exploit within sql server or ado.net itself, but I haven't been able to come up with anything..  so this is my current approach:
The page they use starts-out with basically a blank form.  there are custom-built paging controls at the bottom of the screen.  they click page-forward to begin and a stored procedure is ran to select a record and update a field on that record to indicate "in-process".  when they finish editing the record - or page on to the next record without updating - another stored procedure is ran - updating/resetting the status field on the record appropriately.
The entire page is encapsulated within an ajax.net updatepanel.
The entire page has caching disabled.  This works well in conjunction with the first page being blank.  if they get out of the app and try to get back in by clicking the back button - all they can do is get to the first (blank) page.
A piece of javascript window.onunload clicks a button on the page that releases the record they currently have selected in the event of a re-direct, clicking back, etc.. it appears to work with everything except a window close.  in that case, i have a stored procedure running periodically on the server that checks how long a record has been selected - and if it exceeds the time indicated - resets the record as to allow it to be re-selected later.
In the event of session timeout, they are redirected to another page that tells them their session has timed-out (and since the window.onunload fires - it takes care of releasing the record if they have one on the screen).
The concept seemed to be working well until I started multi-user testing.  Now it seems as if two users time it perfectly - they are actually able to both select the same record.  it happens pretty rarely, but it does seem to happen.  I'm guessing this has to do with how my stored procedure is structured - possibly allowing a tiny-enough window between the record being selected for editing - and the update running to actually status the record as in-process (2 separate sql statements within the one stored procedure).
I believe I also have a found a second quirk in my approach where something is causing the window.onunload event to fire twice in some strange situations..  but that's more annoying/confusing from a logging standpoint than anything..
I've read where people say to ensure you dont update a record that's already been updated - that you should compare the fields before you actually perform the update and ensure they haven't changed since you selected it..  but to me that doesn't solve anything.. if two people select the same record and both spend time working on it - the person that tries to update last has just wasted their time.
I've also toyed with the idea of maintaining a separate table in the database to hold the keys to the currently selected records and use that to keep multiple people from selecting the same record - but honestly i dont know if that approach is any better than what i'm doing now.   
anyway, I was just curious if you guys had any advice in regards to how you'd handle a request like this..  or if you see any obvious problems/fixes with my current approach..
I would greatly appreciate any info you could provide-
thanks-

View 3 Replies View Related

T-SQL (SS2K8) :: Finding Rows Where User Has Access To Contents But Not Record

Mar 27, 2014

I'm got a "folder" structure application which we'll be using as an in-house directory viewer. (In case you're wondering, it doesn't relate to any "real" folders, so using xp_cmdshell is out! )

Each folder and file record can have its own permissions, however these are assumed to inherit from the parent folder if no specific access rules have been set, basically in the same way file systems work. Each file record can only have one parent, and a folder can either have a parent or be at the root level.

Right now I'm having an issue with the inheritance of permissions. Say if I want to grant access to "Folder 1" to "Group A", then "Group B" shouldn't be able to see it. However, if I grant access to "File 1" in "Folder 1" to "Group B", then "Group B" should be able to see "Folder 1", but only see "File 1" and not the rest of the contents.

I thought I could do this with a CTE, but I'm having a bit of difficulty..

Here's the code:

CREATE TABLE #FileSystem (
FSIDINTEGER NOT NULL IDENTITY(1,1) PRIMARY KEY
,ParentFSIDINTEGER NULL
,NameVARCHAR(100)
,RecordTypeVARCHAR(1)-- (F)older, or Fi(L)e

[Code] ....

View 1 Replies View Related

SQL Server 2012 :: How To Return User-defined Row When A Record Doesn't Exists

Dec 29, 2014

What I want to do is return a row of data when my query doesn't return a record. I have two tables:

CREATE TABLE dbo.abc(
SeqNo smallint NULL,
Payment decimal(10, 2) NULL
) ON PRIMARY

[Code] ....

So when I run the following query:

SELECT 'abc' + '-' + CAST(SeqNo AS VARCHAR) + '-' + CAST(Payment AS VARCHAR) FROM abc WHERE SeqNo = 1
UNION
SELECT 'def' + '-' + CAST(SeqNo AS VARCHAR) + '-' + CAST(Payment AS VARCHAR) FROM def WHERE SeqNo = 1
abc-1-200.00
abc-1-500.00

As you can see since 1 doesn't exists in table 'def' nothing is returned as expected. However, if a row isn't returned I want to be able to enter my own row such as

abc-1-200.00
abc-1-500.00
def-0-0.00

View 4 Replies View Related

Locked Out

Apr 10, 2007

I am using the desktop sqlexpress 2005 and I was experimenting with the account setting and I accidentally disabled my access. I am using windows authentication and there is no password, just the windows login name.

How can I reactivate the login for this connection. Any help is greatly appreciated.

View 1 Replies View Related

How To Tell If A Row Is Locked?

Apr 14, 2008

I am writing in regard to this post: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=52798
Which I found while searching for a best-practice way to implement record locking in my application.
In the above referenced post the user asks “How can I tell if a row is locked?�, and the reason for asking is that the user wants to implement logic similar to this:

Select a row for editing.
If the row has been locked by a different user, display the information as read only.
Otherwise, lock the row and allow the user to edit (allow others to read).

My questions are exactly the same as the original poster of the above thread. I was surprised to see that the general response to the post was the user was taking a wrong approach and that sql server is unable to work as the user requested. I think the approach is both correct and desirable (I used it extensively as a foxpro programmer) and I would like further confirmation that sql server does not support it.

One of the things I don’t understand is the interaction between transactions and locks. Is it not possible to lock a row without initiating a transaction? Bottom line, my goal is this:

Select a row for editing.
If the row has been locked by a different user, display the information as read only.
Otherwise, lock the row and allow the user to edit (allow others to read).


However I get there is fine with me.

View 12 Replies View Related

Mdf Locked

May 12, 2008

Hi to all,
I need help about access to mdf file. I don't know when, but sometime my application, build with vbnet, return an error on mdf database access, that is access denied, also winxp return on the mdf file the message "process cannot access the file because it is being used by another process" if I try to delete the mdf file. I can delete the file only if I stop the procss sqlservr.exe from taskmanager. I don't use instruction to open and close database, I use dataset, datatable and sql build in datatable.
Someone can say me why sqlservr.exe don't unlock the mdf file when I close my application?
Thanks..

View 5 Replies View Related

Script Component Has Encountered An Exception In User Code - Object Is Not An ADODB.RecordSet Or An ADODB.Record

Nov 26, 2007

hi have written SSIS script and i am using script component to Row count below my code what i have written. and i am getting error below i have mention...after code see the error
using System;

using System.Data;

using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

using Microsoft.SqlServer.Dts.Runtime.Wrapper;

using System.Data.SqlClient;

using System.Data.OleDb;



[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]

public class ScriptMain : UserComponent

{

IDTSConnectionManager100 connMgr;

OleDbConnection sqlConn = null;

OleDbDataReader sqlReader;



public override void AcquireConnections(object Transaction)

{

connMgr = this.Connections.MyConnection;

sqlConn = (OleDbConnection )connMgr.AcquireConnection(null);

//sqlConn = (SqlConnection)connMgr.AcquireConnection(null);

}

public override void PreExecute()

{

base.PreExecute();

/*

Add your code here for preprocessing or remove if not needed

*/

OleDbCommand cmd = new OleDbCommand("SELECT CustomerID,TerritoryID,AccountNumber,CustomerType FROM Sales.Customer", sqlConn);



sqlReader = cmd.ExecuteReader();

}

public override void PostExecute()

{

base.PostExecute();

/*

Add your code here for postprocessing or remove if not needed

You can set read/write variables here, for example:

Variables.MyIntVar = 100

*/

}

public override void CreateNewOutputRows()

{

/*

Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".

For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".

*/

System.Data.OleDb.OleDbDataAdapter oLead = new System.Data.OleDb.OleDbDataAdapter();

//SqlDataAdapter oLead = new SqlDataAdapter();

DataSet ds = new DataSet();



System.Data.DataTable dt = new System.Data.DataTable();

//DataRow row = new DataRow();

oLead.Fill(dt,this.Variables.ObjVariable);





foreach (DataRow row in dt.Rows)

{

{

Output0Buffer.AddRow();

Output0Buffer.CustomerID = (int)row["CustomerID"];

Output0Buffer.TerritoryID =(int)row["TerritoryID"];

Output0Buffer.AccountNumber = row["AccountNumber"].ToString();

Output0Buffer.CustomerType = row["CustomerType"].ToString();

}

}



}

}
the error
Script component has encountered an exception in user code
Object is not an ADODB.RecordSet or an ADODB.Record.
Parameter name: adodb
at System.Data.OleDb.OleDbDataAdapter.FillFromADODB(Object data, Object adodb, String
srcTable, Boolean multipleResults)
at System.Data.OleDb.OleDbDataAdapter.Fill(DataTable dataTable, Object ADODBRecordSet)
at ScriptMain.CreateNewOutputRows()
at UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs,
Int32[] outputIDs, PipelineBuffer[] buffers)

thanks
kedarnath

View 4 Replies View Related







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