Showing posts with label sqlserver. Show all posts
Showing posts with label sqlserver. Show all posts

Thursday, March 22, 2012

accessing components and task from scripting task

Hi, I have to researching of how to accesss package tasks and component using the SqlServer.Dts.Runtime class and so far, I havent found any solution. For example, if you package has a scriptiong task and a data flow task(<- which contains a data source component). Is it possible to use the scripting component to access the data source component in the data flow task and manipulate its properites like sqlcommand etc.

Emmanuel

An easier and more direct way to do this is to store the sqlcommand for the datasource in a package variable and set the variable value in the script task or even at the time of executing the package.

|||I know that can be done using variables and expressions and all that but i want to know where its possible to access component and dask of a package in a scripting task using a SqlServer.Runtime library. I know you can pass variable around be I want to know how to control component properties in a scripting task or component if possible. If anyone know how to do that or can direct me to the right resource, I will be glad. Thanks.|||Nope, the tasks and components can't directly access each other at runtime.

Tuesday, March 20, 2012

Access/Server

How do you change the connection string of a DataSet?

We have been using MSAccess for our database, but have recently upgraded to SQLServer Express. I was able to successfully upsize the Access database and now all information resides on the server. In my VisualBasic program, the dataset itself has around 200 queries total spread out on multiple table adapters. The problem now is that none of these queries work because the dataset is bound to the Access table. I have changed connection string through code and am able to display the information, but am unable to interact with it until i get the dataset connection changed.

I would rather just change the connection of the dataset somehow rather than build a new dataset, reconnect all forms, and rewrite all tableadapter queries.

Thank you for any help that you can provide.

Hi,

Not knowing which versions of VB and SqlExpress you are using makes it difficult for me to give any practical help, especially as I'm not familar with using prior versions, but the following may be of some use to you.

I've been using VisualStudio2005Pro and SqlExpress2005 for some time, and if its practical for you to upgrade to Visual Studio Express etc.(which is now free), you may find your problem easier to solve. In VS2005, you can use the My.Settings to hold your connection string, which makes it much easier to control. I recently changed from using SqlExpress in User Instance mode to Server mode, which meant having to alter nearly 300 connection string references. By using the find and replace facility in VS2005 (Ctrl F) it took maybe five minutes max to make the changes, including changing the connection string in My.Settings.

You can then always access your database using a connection like dbConnection = New SqlConnection(MySettings.Name of your ConnectionString)

John

|||Thank you for the response. To give a little bit more information i am currently using SQLExpress 2005 and using Visual Studio 2005 Pro as well.

The dataset that i have created in the program that is bound to all of my fields i have done extensive work in developing. Each table adapter in the dataset has anywhere from 1 - 50 queries on it. Just a few days ago i was instructed to change our database from MSAccess to SQLServer. I upsized the data and had no problems. I then changed the ConnectionStrings in the VB program since i was unaware of a way to change the connectionstring of the dataset itself (when you create the dataset, it asks for type of database, and location). With the new connection strings at the top of each form, i am able to access all of the data when i go from form to form. The problem lies when i try to add, change, delete, etc data on a form. Since the add/update/delete/etc call the queries that are located in the table adapters, it is still trying to access the old MSAccess database because that dataset (and the table adapters) are bound to the Access database since creation. When i go in to "Configure DataSet With Wizard", it will let me hit "Previous" for a few screens until i get to the location where i chose the datasource. These fields now are darkened and will not allow me to change the location/type of database that the DataSet is bound to. If there is an easy way to directally change the DataSet bindings without having to re-create the entire dataset i would rather go that path. The other problem lies with the table adapter queries. I recently re-wrote the smaller program's dataset instead of trying to figure out a way to convert it when i realized that the SQL commands for the Table Adapters of MSAccess and SQLServer are so completely different. If i will need to rewrite the SQL queries either way, then i might as well just start from scratch with a new dataset that is bound to the server instead of access.

If there is any other information i can provide please let me know. Thank you so much for the response.|||

With my limited knowledge I'm afraid I am not going to be of much help to you.

When I started with VS2005, I made the conscious decision to not use the wizards when working with datasets, tableAdapters etc, purely so as to have better control. It was a lot more work as a beginner, but has paid off, I believe, in ease of maintaining things. The downside is I dont have the experience which could maybe help you.

I'm sorry I'm out of my depth with regards to your particular problem, however I had a look at the msdn site and found the following site http://msdn2.microsoft.com/en-us/library/76ah1sx7.aspx has some information which you may be able to use.

How to: Edit a Dataset: Edit a TableAdapter: Edit TableAdapter Queries. etc.

I hope you find what you need there. Sorry I cannot be of more assistance. Maybe some of the other readers of this site can be more helpful

Good Luck

John

|||

There is probably some way to do this using the Data Set Wizard, but I haven't quite figured it out. If you created the original DataSet using the wizard though, it actually saved the connection string it uses into your application Settings, so you can just modify the string there.

Just open the application properties and switch to the Settings page. You should see a connection string setting. Just change the connection string, but not the setting name. As long as everything else is exactly the same, table names ,etc., it should just work.

Let me know how it turns out.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

|||You have it exactally right on. I went into the settings and was able to change the string with out any difficulty. I am getting a few errors now but i think that they will be easy to resolve.

Server=ACSFRONTDESK\SQLExpress;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ALTDB.mdf;Database=ALTDB;Trusted_Connection=Yes;

Connection Failed;
SQLState: '42000'
SQL Server Error: 1801
Database 'c\.................\ALTDB.mdf' already exists.
Connection Failed;
SQLState: '42000'
SQL Server Error: 1832
Could not attatch file "C:\.................\ALTDB.mdf" as database 'ALTDB'.

From the looks of it, it is trying to copy it over for some reason. I see that in the connection string it says "AttachDbFilename" but i am not sure what it is for. I did delete that section out of the string and i still got the same message.

It is also not letting me log in to the database at all now giving me some a different error in the program that did have a successful connection:

An error occurred while retrieving the information for the database;

Can not open user default database. Login Failed.
Login failed for user.

All of the connections i have to the database are through TrustedConnection and Windows Authentication. As i said, this is the one connection that kept working even after the "expandos" droped out of the Managment Studio. I will keep playing with it to see if i can come up with anything else. If i am using the incorrect connection string please let me know. I have tried several different variations of the string and none have been successful.|||

If the database is already attached at the server you should not need to specify AttachDbFileName. This keyword is used to cause SQL to automatically attache the database when an application starts. I'd recomend using the following:

Server=ACSFRONTDESK\SQLExpress;Database=ALTDB;Trusted_Connection=Yes;

Mike

|||I have entered the new connection string. I am getting 1 error as i try to synchronize the DataSet and that is:

An error occurred while retrieving the information for the database;

Can not open user default database. Login Failed.
Login failed for user.

This i am sure i can get rid of once i get the database back up and running properly. Thank you so much for your time and help in resolving this issue.
|||

Hope this post is not out of place, but I have a question for Mike.

Using SqlExpress, I use the following connection string:

Data Source= .\SqlExpress;Initial Catalog=Bradview;integrated Security = True which is somewhat different to the example you showed above. Does it do exactly the same thing.?

John

|||

Too many Johns on this thread!

The two are functionally equivalent as far as I can tell. 'Data Source' specifies the same information as 'Server' and 'Database' specifies the same information as 'Initial Catalog'. I have not worked out what the difference is between these syntaxes, but they are used interchangably in my experience.

There is probably some eceedingly technical reason for these different keywords. I welcome comments from anyone who might know what they are.

Mike

|||

Thanks Mike,

The explanation does make me feel better. I've been trying to help where I think I can add to someone's knowledge, expecially a beginner like myself, but decided I was probably doing more harm than good, so have kept my mouth shut lately (so to speak).

I'd also be interested to know the differences in the keywords, if it's a major point of difference.

There can never be too many Johns.!! <grin>

Thanks again

John

|||One more question about this matter. As i said i used the connection string that you provided me Mike and it works perfect on one of the 2 programs. The other program however errors out and says that i need to include a 'Provider' in the connection string. I did this with a few different 'Providers' and have now come across a weird thing.

The SQL statments inside my DataSet (each table adapter allows you to Add Query) between the 2 programs are now vastly different. I will show some different syntax.

Access Insert:
INSERT INTO `OwnerInfo` (`OwnerDescription`, `Name`, `Address1`, `Address2`, `City`, `State`, `AmtDue`, `Credit`, `Phone`, `Zip`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

SQL Server Insert (no 'Provider'):
INSERT INTO [dbo].[OwnerInfo] ([OwnerDescription], [Name], [Address1], [Address2], [City], [State], [AmtDue], [Credit], [Phone], [Zip]) VALUES (@.OwnerDescription, @.Name, @.Address1, @.Address2, @.City, @.State, @.AmtDue, Credit, @.Phone, @.Zip);

Hybrid (error and requires 'Provider'):
INSERT INTO [dbo].[OwnerInfo] ([OwnerDescription], [Name], [Address1], [Address2], [City], [State], [AmtDue], [Credit], [Phone], [Zip]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

My question is what 'Provider' should i use so that all of my SQL is the same? Both programs are inserting data into the exact same server into the exact same table. Is the 'Provider' even the source of the SQL difference? I am trying to get a standard set so that it will be easy to change/update in the future. One of the programs is completely finished (the one with no 'Provider' - SQL Server Insert example) and would like to finish changing the other one to match the same syntax as the previous. Any ideas?

Access XP and SqlServer 2005?

I'm not able to edit the database structure of a SqlServer 2005 database from Access XP (Access complains about not understanding
the SqlServer structure...which is not suprising).
The alert messages suggest looking for a patch from Microsoft to correct the problem.
Is there such a patch? Or a workaround? If not, what user-friendly front-ends are available to work with SqlServer 2005?
- Mark
Hi Mark,
Welcome to use MSDN Managed Newsgroup!
From your descriptions, I understood you would like to know whether you
could use Access to configure SQL Server 2005 tables. If I have
misunderstood your concern, please feel free to point it out.
However, unfortunately, for now, we do not have the such pack available in
both SQL Server 2005 and Office 2003 Access.
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.

Monday, March 19, 2012

Access Violoation

The following fairly basic stored proc runs perfectly on my laptop (SQL
Server 2000 - 8.00.194 Personal Edition), but on my dev server (SQL Server
2000 - 8.00.760 Enterprise Edition, SP3) I get: SqlDumpExceptionHandler:
Process xx generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL
Server is terminating this process..
Any help is most appreciated.
CREATE Procedure oContent_ins_Attachment
@.int_AttachmentTypeID int,
@.str_LinkPath text,
@.str_UserID varchar(100),
@.str_HistoryUserID varchar(100),
@.byt_FileContent image = null,
@.int_FileLength int = 0,
@.str_FileType varchar(50) = null,
@.str_LinkTitle varchar(255) = null,
@.str_FileName varchar(100) = null,
@.str_FileExt varchar(10) = null,
@.int_AttachmentID int output
AS
BEGIN
SET NOCOUNT ON
declare @.str_HyperlinkPath varchar(1000)
begin tran
select @.int_AttachmentID = isnull(max(AttachmentID),0)+1 from
AttachmentDetail
if @.@.error != 0
begin
if @.@.trancount > 0
begin
rollback tran
select @.int_AttachmentID = 0
return -1
end
else
return -1
end
if @.str_FileExt is null
insert into AttachmentDetail (AttachmentID, AttachmentTypeID, LinkPath,
LinkDate, LinkTitle, UserID, FileName)
values (@.int_AttachmentID, @.int_AttachmentTypeID, @.str_LinkPath,
getdate(), @.str_LinkTitle, @.str_UserID, @.str_FileName)
else
insert into AttachmentDetail (AttachmentID, AttachmentTypeID, LinkPath,
LinkDate, LinkTitle, UserID, FileName)
values (@.int_AttachmentID,
@.int_AttachmentTypeID,
convert(varchar(1000),@.str_LinkPath) +
convert(varchar(1000),@.int_AttachmentID) + @.str_FileExt,
getdate(),
@.str_LinkTitle,
@.str_UserID,
@.str_FileName)
if @.@.error != 0
begin
if @.@.trancount > 0
begin
rollback tran
select @.int_AttachmentID = 0
return -2
end
else
return -2
end
else
if @.@.trancount > 0
commit tran
insert into AttachmentDetail_H
select *, @.str_HistoryUserID, 'Inserted', getdate(), null
from AttachmentDetail
where AttachmentID = @.int_AttachmentID
if @.byt_FileContent is not null
begin
insert into AttachedFiles (AttachmentID, FileContent, FileSize, MimeType)
values (@.int_AttachmentID, @.byt_FileContent, @.int_FileLength,
@.str_FileType)
insert into AttachedFiles_H
select *, @.str_HistoryUserID, 'Inserted', getdate(), null
from AttachedFiles
where AttachmentID = @.int_AttachmentID
end
SET NOCOUNT OFF
END
If you give a full repro (e.g. table structure, sample data, an example call
to the proc, etc.) we can try to reproduce the AV on newer builds, so you
can know if it is already fixed on a post-SP3 build, or if you've found a
new bug.
See http://www.aspfaq.com/5006 for details.
(Also, update your laptop... you are practically begging to get infected by
Slammer.)
http://www.aspfaq.com/
(Reverse address to reply.)
"smay" <smay@.discussions.microsoft.com> wrote in message
news:4C55F48E-741E-41BF-8C13-37AE9EBBE5E2@.microsoft.com...
> The following fairly basic stored proc runs perfectly on my laptop (SQL
> Server 2000 - 8.00.194 Personal Edition), but on my dev server (SQL
Server
> 2000 - 8.00.760 Enterprise Edition, SP3) I get: SqlDumpExceptionHandler:
> Process xx generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION.
SQL
> Server is terminating this process..
> Any help is most appreciated.
> CREATE Procedure oContent_ins_Attachment
> @.int_AttachmentTypeID int,
> @.str_LinkPath text,
> @.str_UserID varchar(100),
> @.str_HistoryUserID varchar(100),
> @.byt_FileContent image = null,
> @.int_FileLength int = 0,
> @.str_FileType varchar(50) = null,
> @.str_LinkTitle varchar(255) = null,
> @.str_FileName varchar(100) = null,
> @.str_FileExt varchar(10) = null,
> @.int_AttachmentID int output
> AS
> BEGIN
> SET NOCOUNT ON
> declare @.str_HyperlinkPath varchar(1000)
> begin tran
> select @.int_AttachmentID = isnull(max(AttachmentID),0)+1 from
> AttachmentDetail
> if @.@.error != 0
> begin
> if @.@.trancount > 0
> begin
> rollback tran
> select @.int_AttachmentID = 0
> return -1
> end
> else
> return -1
> end
> if @.str_FileExt is null
> insert into AttachmentDetail (AttachmentID, AttachmentTypeID, LinkPath,
> LinkDate, LinkTitle, UserID, FileName)
> values (@.int_AttachmentID, @.int_AttachmentTypeID, @.str_LinkPath,
> getdate(), @.str_LinkTitle, @.str_UserID, @.str_FileName)
> else
> insert into AttachmentDetail (AttachmentID, AttachmentTypeID, LinkPath,
> LinkDate, LinkTitle, UserID, FileName)
> values (@.int_AttachmentID,
> @.int_AttachmentTypeID,
> convert(varchar(1000),@.str_LinkPath) +
> convert(varchar(1000),@.int_AttachmentID) + @.str_FileExt,
> getdate(),
> @.str_LinkTitle,
> @.str_UserID,
> @.str_FileName)
> if @.@.error != 0
> begin
> if @.@.trancount > 0
> begin
> rollback tran
> select @.int_AttachmentID = 0
> return -2
> end
> else
> return -2
> end
> else
> if @.@.trancount > 0
> commit tran
> insert into AttachmentDetail_H
> select *, @.str_HistoryUserID, 'Inserted', getdate(), null
> from AttachmentDetail
> where AttachmentID = @.int_AttachmentID
> if @.byt_FileContent is not null
> begin
> insert into AttachedFiles (AttachmentID, FileContent, FileSize, MimeType)
> values (@.int_AttachmentID, @.byt_FileContent, @.int_FileLength,
> @.str_FileType)
> insert into AttachedFiles_H
> select *, @.str_HistoryUserID, 'Inserted', getdate(), null
> from AttachedFiles
> where AttachmentID = @.int_AttachmentID
> end
> SET NOCOUNT OFF
> END

Access Violoation

The following fairly basic stored proc runs perfectly on my laptop (SQL
Server 2000 - 8.00.194 Personal Edition), but on my dev server (SQL Server
2000 - 8.00.760 Enterprise Edition, SP3) I get: SqlDumpExceptionHandler:
Process xx generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQ
L
Server is terminating this process..
Any help is most appreciated.
CREATE Procedure oContent_ins_Attachment
@.int_AttachmentTypeID int,
@.str_LinkPath text,
@.str_UserID varchar(100),
@.str_HistoryUserID varchar(100),
@.byt_FileContent image = null,
@.int_FileLength int = 0,
@.str_FileType varchar(50) = null,
@.str_LinkTitle varchar(255) = null,
@.str_FileName varchar(100) = null,
@.str_FileExt varchar(10) = null,
@.int_AttachmentID int output
AS
BEGIN
SET NOCOUNT ON
declare @.str_HyperlinkPath varchar(1000)
begin tran
select @.int_AttachmentID = isnull(max(AttachmentID),0)+1 from
AttachmentDetail
if @.@.error != 0
begin
if @.@.trancount > 0
begin
rollback tran
select @.int_AttachmentID = 0
return -1
end
else
return -1
end
if @.str_FileExt is null
insert into AttachmentDetail (AttachmentID, AttachmentTypeID, LinkPath,
LinkDate, LinkTitle, UserID, FileName)
values (@.int_AttachmentID, @.int_AttachmentTypeID, @.str_LinkPath,
getdate(), @.str_LinkTitle, @.str_UserID, @.str_FileName)
else
insert into AttachmentDetail (AttachmentID, AttachmentTypeID, LinkPath,
LinkDate, LinkTitle, UserID, FileName)
values (@.int_AttachmentID,
@.int_AttachmentTypeID,
convert(varchar(1000),@.str_LinkPath) +
convert(varchar(1000),@.int_AttachmentID)
+ @.str_FileExt,
getdate(),
@.str_LinkTitle,
@.str_UserID,
@.str_FileName)
if @.@.error != 0
begin
if @.@.trancount > 0
begin
rollback tran
select @.int_AttachmentID = 0
return -2
end
else
return -2
end
else
if @.@.trancount > 0
commit tran
insert into AttachmentDetail_H
select *, @.str_HistoryUserID, 'Inserted', getdate(), null
from AttachmentDetail
where AttachmentID = @.int_AttachmentID
if @.byt_FileContent is not null
begin
insert into AttachedFiles (AttachmentID, FileContent, FileSize, MimeType)
values (@.int_AttachmentID, @.byt_FileContent, @.int_FileLength,
@.str_FileType)
insert into AttachedFiles_H
select *, @.str_HistoryUserID, 'Inserted', getdate(), null
from AttachedFiles
where AttachmentID = @.int_AttachmentID
end
SET NOCOUNT OFF
ENDIf you give a full repro (e.g. table structure, sample data, an example call
to the proc, etc.) we can try to reproduce the AV on newer builds, so you
can know if it is already fixed on a post-SP3 build, or if you've found a
new bug.
See http://www.aspfaq.com/5006 for details.
(Also, update your laptop... you are practically begging to get infected by
Slammer.)
http://www.aspfaq.com/
(Reverse address to reply.)
"smay" <smay@.discussions.microsoft.com> wrote in message
news:4C55F48E-741E-41BF-8C13-37AE9EBBE5E2@.microsoft.com...
> The following fairly basic stored proc runs perfectly on my laptop (SQL
> Server 2000 - 8.00.194 Personal Edition), but on my dev server (SQL
Server
> 2000 - 8.00.760 Enterprise Edition, SP3) I get: SqlDumpExceptionHandler:
> Process xx generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION.
SQL
> Server is terminating this process..
> Any help is most appreciated.
> CREATE Procedure oContent_ins_Attachment
> @.int_AttachmentTypeID int,
> @.str_LinkPath text,
> @.str_UserID varchar(100),
> @.str_HistoryUserID varchar(100),
> @.byt_FileContent image = null,
> @.int_FileLength int = 0,
> @.str_FileType varchar(50) = null,
> @.str_LinkTitle varchar(255) = null,
> @.str_FileName varchar(100) = null,
> @.str_FileExt varchar(10) = null,
> @.int_AttachmentID int output
> AS
> BEGIN
> SET NOCOUNT ON
> declare @.str_HyperlinkPath varchar(1000)
> begin tran
> select @.int_AttachmentID = isnull(max(AttachmentID),0)+1 from
> AttachmentDetail
> if @.@.error != 0
> begin
> if @.@.trancount > 0
> begin
> rollback tran
> select @.int_AttachmentID = 0
> return -1
> end
> else
> return -1
> end
> if @.str_FileExt is null
> insert into AttachmentDetail (AttachmentID, AttachmentTypeID, LinkPath,
> LinkDate, LinkTitle, UserID, FileName)
> values (@.int_AttachmentID, @.int_AttachmentTypeID, @.str_LinkPath,
> getdate(), @.str_LinkTitle, @.str_UserID, @.str_FileName)
> else
> insert into AttachmentDetail (AttachmentID, AttachmentTypeID, LinkPath,
> LinkDate, LinkTitle, UserID, FileName)
> values (@.int_AttachmentID,
> @.int_AttachmentTypeID,
> convert(varchar(1000),@.str_LinkPath) +
> convert(varchar(1000),@.int_AttachmentID)
+ @.str_FileExt,
> getdate(),
> @.str_LinkTitle,
> @.str_UserID,
> @.str_FileName)
> if @.@.error != 0
> begin
> if @.@.trancount > 0
> begin
> rollback tran
> select @.int_AttachmentID = 0
> return -2
> end
> else
> return -2
> end
> else
> if @.@.trancount > 0
> commit tran
> insert into AttachmentDetail_H
> select *, @.str_HistoryUserID, 'Inserted', getdate(), null
> from AttachmentDetail
> where AttachmentID = @.int_AttachmentID
> if @.byt_FileContent is not null
> begin
> insert into AttachedFiles (AttachmentID, FileContent, FileSize, MimeType)
> values (@.int_AttachmentID, @.byt_FileContent, @.int_FileLength,
> @.str_FileType)
> insert into AttachedFiles_H
> select *, @.str_HistoryUserID, 'Inserted', getdate(), null
> from AttachedFiles
> where AttachmentID = @.int_AttachmentID
> end
> SET NOCOUNT OFF
> END

ACCESS VIOLATION ERROR

I have been experiencing a fatal error for one of the SQL
Server services on our development server. Upon
investigating on the internet it would appear that we are
not alone in this. The only fix at present appears to be
a server reboot. The error looks something like:
Error: 0, Severity: 19, State: 0
SqlDumpExceptionHandler: Process 56 generated fatal
exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server
is terminating this process.
Until the server was rebooted, some SQL statements (from
any application) worked and others did not. Very
disturbing when using frames within IE, and the queries
running in the upper frame function correctly and the
queries running in the lower frame bomb out (with an error
message akin to 17066 :SQL Server Assertion: File:
< S:\sql\ntdbms\storeng\drs\include\record
.inl>, line=1447
Failed Assertion = 'm_SizeRec > 0 && m_SizeRec <=
MAXDATAROW'.).
Does anybody know the cause of this error message?
ThanksHi Alex.
That seems to be a SQL Server bug. Do make sure that your development server
is fully up to date with service packs as these types of bugs are regularly
picked up & fixed in service packs.
It might help if you posted what SQL is actually being executed when the AV
occurs. If you could send the query & underlying tables someone might be
able to provide you with an equivalent / alternative query which might be an
easy work-around for your immediate problem. There's really not enough
information in your current post to go off though.
Regards,
Greg Linwood
SQL Server MVP
"Alex" <anonymous@.discussions.microsoft.com> wrote in message
news:14e6201c41571$acde15e0$a501280a@.phx
.gbl...
> I have been experiencing a fatal error for one of the SQL
> Server services on our development server. Upon
> investigating on the internet it would appear that we are
> not alone in this. The only fix at present appears to be
> a server reboot. The error looks something like:
> Error: 0, Severity: 19, State: 0
> SqlDumpExceptionHandler: Process 56 generated fatal
> exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server
> is terminating this process.
> Until the server was rebooted, some SQL statements (from
> any application) worked and others did not. Very
> disturbing when using frames within IE, and the queries
> running in the upper frame function correctly and the
> queries running in the lower frame bomb out (with an error
> message akin to 17066 :SQL Server Assertion: File:
> < S:\sql\ntdbms\storeng\drs\include\record
.inl>, line=1447
> Failed Assertion = 'm_SizeRec > 0 && m_SizeRec <=
> MAXDATAROW'.).
> Does anybody know the cause of this error message?
> Thanks
>

Sunday, March 11, 2012

Access to Sqlserver transfering ?

I am having Access database in my local system . Values in the access database will be updated for every 5 min .

I am also having Sqlserver database online with the same structure database of Access in my local system .

What i want is my Access database values must be updated in my online sqlserver at every 5 min automatically .How to do that ?
I hope your database isn't too big. Google around about the DTS packages of SQL Server. You can make one (it defines import/export mechanism), then call it periodically.|||

You can set a flag column in access database with default value 0. If the data is updated set flag to 1.

Then you run a program periodically update the updated data in access to sql server and set all flags to 0.

|||

hi dear ;

i think u mast using datareader object (connected datasource) to get ur data online updated but u mast try to refrishing it.

dont use dataset (disconnected datasource)Smile

access to sqlserver database from web

Hi
I do not want to install SQL server client on every user machine.
I want to give users access from browser to the sqlserver 2000 database.
Is it possible?
I saw sqlserver webadministrator?
From the name it looks like a administration tool?
Thanks
Mangesh
"SQL Server Web Data Administrator"
http://www.microsoft.com/downloads/d...displaylang=en
Cristian Lefter, SQL Server MVP
"Mangesh Deshpande" <MangeshDeshpande@.discussions.microsoft.com> wrote in
message news:8B328C00-790E-4FD0-82F3-022F3C6ABA40@.microsoft.com...
> Hi
> I do not want to install SQL server client on every user machine.
> I want to give users access from browser to the sqlserver 2000 database.
> Is it possible?
> I saw sqlserver webadministrator?
> From the name it looks like a administration tool?
> Thanks
> Mangesh

access to sqlserver database from web

Hi
I do not want to install SQL server client on every user machine.
I want to give users access from browser to the sqlserver 2000 database.
Is it possible?
I saw sqlserver webadministrator?
From the name it looks like a administration tool'
Thanks
Mangesh"SQL Server Web Data Administrator"
http://www.microsoft.com/downloads/details.aspx?FamilyID=C039A798-C57A-419E-ACBC-2A332CB7F959&displaylang=en
Cristian Lefter, SQL Server MVP
"Mangesh Deshpande" <MangeshDeshpande@.discussions.microsoft.com> wrote in
message news:8B328C00-790E-4FD0-82F3-022F3C6ABA40@.microsoft.com...
> Hi
> I do not want to install SQL server client on every user machine.
> I want to give users access from browser to the sqlserver 2000 database.
> Is it possible?
> I saw sqlserver webadministrator?
> From the name it looks like a administration tool'
> Thanks
> Mangesh

access to sqlserver database from web

Hi
I do not want to install SQL server client on every user machine.
I want to give users access from browser to the sqlserver 2000 database.
Is it possible?
I saw sqlserver webadministrator?
From the name it looks like a administration tool'
Thanks
Mangesh"SQL Server Web Data Administrator"
http://www.microsoft.com/downloads/...&displaylang=en
Cristian Lefter, SQL Server MVP
"Mangesh Deshpande" <MangeshDeshpande@.discussions.microsoft.com> wrote in
message news:8B328C00-790E-4FD0-82F3-022F3C6ABA40@.microsoft.com...
> Hi
> I do not want to install SQL server client on every user machine.
> I want to give users access from browser to the sqlserver 2000 database.
> Is it possible?
> I saw sqlserver webadministrator?
> From the name it looks like a administration tool'
> Thanks
> Mangesh

Access to SQLServer Database from Visual C# app and ASP.NET app

I've created a visual C# GUI that logs data over a LAN. The GUI is for Admin purposes only so it logs data and stores it (plus some admin stuff). The data that is logged is supposed to be served up to anyone on the network as a web app. I've got an instance of SQLServer running and the GUI works great but I can't seem to get the web app to connect to the database to read and display the data for general users?

I'm new to ASP.NET and SQL Server so a little extra explanation or steps that I'm missing wouldn't hurt me if you have the time to spare.

I get an error that says "Cannot get web application service" in Visual Studio when I try and drag and drop a SQLDataSource onto my pages and configure it. It then asks me to Choose My DataConnection from the drop down and there's no connection there...

I tried setting it up in the code behind page like I would in Visual C# (small code example below) by adding in using System.Data.SqlClient; etc.. and it throws me a nasty notice (see below). Obviously it doesn't like this user but how do I fix this so I can server up my DB to work for both my GUI and ASP apps? I noticed when looking at my DB that the owner is TUDOR\Windows is there a way to have multiple owners to a DB if this is what's wrong?

String conn = @."Server=TUDOR\sqlexpress;" +

"Integrated Security=True;" +

"Database=ATSDB";

// Specify SQL Server-specific connection string

SqlConnection dbconn = new SqlConnection(conn);

// Create DataAdapter object

SqlDataAdapter dbadpt = new SqlDataAdapter("SELECT FirstName FROM tblPersonInfo WHERE FirstName = 'Kim'", dbconn);

// Create CommandBuilder object to build SQL commands

SqlCommandBuilder dbcmd = new SqlCommandBuilder(dbadpt);

// Create DataSet to contain related data tables, rows, and columns

DataSet dbset = new DataSet();

// Fill DataSet using query defined previously for DataAdapter

dbadpt.Fill(dbset, "tblPersonInfo");

Server Error in '/ATS' Application.

Cannot open database "ATSDB" requested by the login. The login failed.
Login failed for user 'TUDOR\ASPNET'.

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: Cannot open database "ATSDB" requested by the login. The login failed.
Login failed for user 'TUDOR\ASPNET'.
Source Error:
Line 32: Line 33: // Fill DataSet using query defined previously for DataAdapter Line 34: dbadpt.Fill(dbset, "tblPersonInfo"); Line 35: } Line 36: }

Source File: c:\Inetpub\wwwroot\ATS\text\Default2.aspx.cs Line: 34 Hi there,

ASP.NET web applications, by default, will run under their own account. In your case, this account seems to be TUDOR\ASPNET.

The problem seems to be that this account is not set up as a login in SQL Server. You need to create a login for TUDOR\ASPNET for your SQL Server and give it access to the required databases.

You can do this by (sorry if you already know this bit):

1) Open Management Studio Express (I presume from reading your code that you are using SQL Server Express Edition) and connect to your SQL Server Instance

2) Expand the node for your SQL Server instance and you will see a node labelled "Security"

3) Right click on the "Security" node and select "New > Login" from the context menu that appears

4) A new dialog window will appear. Enter "TUDOR\ASPNET" as the user and make sure that the Windows Authentication radio button is selected. Set the default database as required (in your case this will probably be ATSDB)

5) In the dialog, on the left hand side there should be an item called "Server Roles". Click on this and then define whatever server roles (e.g. sysadmin) TUDOR\ASPNET will have....What roles the user'll have is entirely up to you

6) In the dialog, on the left hand side there should be an item called "User Mapping". Click on this and then select which databases TUDOR\ASPNET will have access to (in your case, most definately select ATSDB). Also, select what database role (e.g. dbowner) the account will have....Once again, this is up to you to determine

7) Nothing else is particularly interesting so just click OK to finish the process

After you have given access to TUDOR\ASPNET to your SQL Server, you should be able to use your ASP.NET application without getting that error.

Hope that helps a bit, but sorry if it doesn't
|||That sounds like exactly what I need to do. I am using Sql Server Express, from what I've read that is what comes with Visual Studio 2005 but I can't find Management Studio Express? Is that something that only comes with Express Edition software? When I was asked to do this I went out and bought some O'Reilly books but I also bought a couple Express Edition books so I could get up and going fast so if the code looks unelegant that might be why or maybe it was the /SQLExpress that gave it away. Thanks for all the notes I didn't know how to do all that and if I can find Management Studio Express that would definetly solve all my problems. Is it under something else in Visual Studio 2005 Pro Edition?|||Hi there,

Management Studio Express is a seperate download. You can get it from the below link.

SQL Server Express Edition Downloads

After you download & install it, you should be good to go. When Management Studio asks you to connect, your server name, by reading your code should be TUDOR\SQLEXPRESS.

Using Management Studio Express you can connect via SQL Server Authentication (using an account like "sa") or Windows Authentication. If you connect via Windows Authentication but find you can't modify users then your account probably does not have the required privileges. If you switch to the "sa" account you should be fine.

Hope that helps a bit.
|||Thanks so much for your help and your explanations. That's a lot of typing to do to help out someone you don't know. Much appreciated. Works great.

Tuesday, March 6, 2012

Access SQLServer Express Using ADODB

Hi,

How should I do to access a table in SQLServer Express database using VB.NET and ADODB?

Thanks!

Hi Ciro,

I would recommend using the SqlConnection object in VB.Net as it gives you all the new hotness of SNAC rather than MDCA. SNAC supports both ODBC and OLEDB. Here is an example that I created almost completely using the Insert Snippet functionality in VS 2005. (i.e. You hardly need to know how to code these days.)

Code Snippet

Imports System.Data.SqlClient

Module Module1

Sub Main()

Dim conn As New SqlConnection()

conn.ConnectionString = "Data Source=.\SQLEXPRESS;Initial Catalog=AdventureWorksLT;Persist Security Info=True;Integrated Security=True"

Dim cmd As New SqlCommand()

cmd.CommandType = CommandType.Text

cmd.CommandText = "SELECT * FROM SalesLT.Customer"

cmd.Connection = conn

Dim reader As SqlDataReader

Dim previousConnectionState As ConnectionState = conn.State

Try

If conn.State = ConnectionState.Closed Then

conn.Open()

End If

reader = cmd.ExecuteReader()

Using reader

While reader.Read

' Process SprocResults datareader here.

Console.WriteLine(reader.GetValue(3) & " " & reader.GetValue(5))

End While

End Using

Finally

If previousConnectionState = ConnectionState.Closed Then

conn.Close()

End If

End Try

End Sub

End Module

This gives you full access to all the SQL 2005 features.

If you just can't use SNAC, then the ADODB code for accessing SQL Express has not changed, just reference the ADODB library in your project and write standard ADODB code. You can find all kinds of sample connection strings at http://ConnectionStrings.com, where they suggest the following for OLEDB connections:

Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;

One you have that you do the whole

Code Snippet

Dim conn As New ADODB.Connection

And you're on your way...

Mike

|||

Hi Mike,

Thank you for your reply.

I realy need to use ADODB, because in my project, I need a Recordset object.

I visited http://connectionstrings.com/ (it′s realy a nice site) and a I found the string connection:

"Driver={SQL Native Client};" & _

"Server=.\SQLExpress;" & _

"AttachDbFilename=c:\PathToMyDatabaseFile\MyDataBasefile.mdf;" & _

"Database=dbname;" & _

"Trusted_Connection=Yes;"

The first time that I run the code, it worked nice, but when I tried again, I received the follow error message:

[Microsoft][SQL Native Client][SQL Server]Cannot open database "dbname" requested by the login. The login failed.

I tried to remove "Database=dbname;" but it didn′t work too:

"[Microsoft][SQL Native Client][SQL Server]Cannot open user default database. Login failed."

VB.NET and SQLServer Express are a new word to me, and I don′t have any idea about how to solve this problem.

|||

I tried new experiments:

Now, I tried to access the database file using VB6 and VB.Net at the some time.

The first access worked properly, but for second one, I received the following message:

[Microsoft][SQL Native Client][SQL Server]Unable to open the physical file "C:\MyFilePath\MyFileName.mdf". Operating system error 32 (The file has been used in another process"

As I said before, SQLSERVER EXPRESS is a new world fo me, and I don't have any idea about how to solve this problem.

Thanks for any kind of help.

|||

Hi Ciero,

First off, you mentioned that you really need to use ADODB, but then you indicated that you're using the SQL Native Client anyway, which is different. Anyway...

You're getting messed up because you're using both AttachDbFilename and Database and things are getting mixed up in the translation. You should probably use only one of these:

Use AttachDbFilename if you are using a user instance by placing your database file directly in your project and letting VB.NET create the connection string for you. Use Database is you are working with a database that is already created in your SQL Express instance and you're just connecting to it.|||Thank you, Mike!

Friday, February 24, 2012

access project front end and SPs

Hi,
I have recently upsized an Access database to SQLServer. This has required
me rewriting the majority of the queries.
My question is this: How do I reference a control on an Access form in an
SP. (I have a query whose WHERE statement requires a value input by the user
on a form).
Many Thanks,
PeteThe SP can NOT reference a control on a form... In the form you must call
the sp passing the control's value as a parameter to the sp
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Italian Pete" <ItalianPete@.discussions.microsoft.com> wrote in message
news:4B22054F-3043-4F39-979E-C88A747A01A6@.microsoft.com...
> Hi,
> I have recently upsized an Access database to SQLServer. This has
> required
> me rewriting the majority of the queries.
> My question is this: How do I reference a control on an Access form in an
> SP. (I have a query whose WHERE statement requires a value input by the
> user
> on a form).
> Many Thanks,
> Pete|||You should be able to use a Pass-through Query from Access --> SQL - filling
the parameters on the FE and passing the query call to SQL. The sp itself
can't reference the FE controls.
"Italian Pete" wrote:

> Hi,
> I have recently upsized an Access database to SQLServer. This has requir
ed
> me rewriting the majority of the queries.
> My question is this: How do I reference a control on an Access form in an
> SP. (I have a query whose WHERE statement requires a value input by the us
er
> on a form).
> Many Thanks,
> Pete|||Wayne,
What would the syntax for passing the controls as parameters be? ( I can't
seem to find a reference to it in the Access help files).
"Wayne Snyder" wrote:

> The SP can NOT reference a control on a form... In the form you must call
> the sp passing the control's value as a parameter to the sp
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Italian Pete" <ItalianPete@.discussions.microsoft.com> wrote in message
> news:4B22054F-3043-4F39-979E-C88A747A01A6@.microsoft.com...
>
>|||On a forms properties list (for example) is an item called "Input Parameters
"
You could put the values there, it takes some fiddling to get the order
right if you were going to use the onOpen event of the form to read in the
values from controls
eg:
Me.InputParameters = "@.a_variable a_datatype(a_length) = 'a_value'"
Me.RecordSource = "a_sproc_name"
Me.OrderByOn = True
Me.OrderBy = "a_field, another_field"
Me.UniqueTable = "table_name_to_be_updated"
real:
Me.InputParameters = "@.TYPE varchar(25) = 'My_Text'"
Me.RecordSource = "sp_Do_Some"
Me.OrderByOn = true
Me.OrderBy = "Year"
Me.UniqueTable = "tbl_Main"
"Italian Pete" wrote:
> Wayne,
> What would the syntax for passing the controls as parameters be? ( I can't
> seem to find a reference to it in the Access help files).
> "Wayne Snyder" wrote:
>

Sunday, February 19, 2012

access one remote SQL server using 2 different users accounts via Enterprise Manager

Hello,
I ran into a strange situation. I need to access the same remote SQL
server using 2 different user accounts at the same time. I can't seem
to do it using Enterprise Manager.
This is the first time I ran into this type of problem. I signed up for
web hosting service with a company called Netnation. They have a
strange policy- everytime, I create a database on their MS SQL server,
they give me a new user account to access the new database. so if i own
2 databases, then i will have to use 2 user names for the databases.
each user name can only access one database.
I am have problem configuring my Enterprise Manager to allow me to see
more than one database at a time because of the "one -user-one
-database" problem.
Does anyone know if there is anyway i can set up Enterprise Manager to
get round this problem?
Thank you in advance!
Eddy
One option is to register the server twice - create an alias
for the server and then register the second one with that
alias. You can use the second set of credentials to register
the second instance of the server with the alias.
So you'd end up with two server nodes pointing to the same
server but it would still be in one Enterprise Manager
console.
-Sue
On 16 Jan 2006 16:39:52 -0800, eddiekwang@.hotmail.com wrote:

>Hello,
>I ran into a strange situation. I need to access the same remote SQL
>server using 2 different user accounts at the same time. I can't seem
>to do it using Enterprise Manager.
>This is the first time I ran into this type of problem. I signed up for
>web hosting service with a company called Netnation. They have a
>strange policy- everytime, I create a database on their MS SQL server,
>they give me a new user account to access the new database. so if i own
>2 databases, then i will have to use 2 user names for the databases.
>each user name can only access one database.
>I am have problem configuring my Enterprise Manager to allow me to see
>more than one database at a time because of the "one -user-one
>-database" problem.
>Does anyone know if there is anyway i can set up Enterprise Manager to
>get round this problem?
>Thank you in advance!
>Eddy
|||Sue,
Thanks for the reply. I already tried registering the server twice but
it didn't let me. I can't remember the specifics of the error message.
Did it ever work for you?
Eddy
|||Hi Eddy,
Yes...worked fine. You need to have it registered under a
different name than the current registration. That's why I
said to create an alias first. Then register the alias. You
probably tried to register it twice with the same name.
-Sue
On 20 Jan 2006 12:34:49 -0800, eddiekwang@.hotmail.com wrote:

>Sue,
>Thanks for the reply. I already tried registering the server twice but
>it didn't let me. I can't remember the specifics of the error message.
>Did it ever work for you?
>Eddy

access one remote SQL server using 2 different users accounts via Enterprise Manager

Hello,
I ran into a strange situation. I need to access the same remote SQL
server using 2 different user accounts at the same time. I can't seem
to do it using Enterprise Manager.
This is the first time I ran into this type of problem. I signed up for
web hosting service with a company called Netnation. They have a
strange policy- everytime, I create a database on their MS SQL server,
they give me a new user account to access the new database. so if i own
2 databases, then i will have to use 2 user names for the databases.
each user name can only access one database.
I am have problem configuring my Enterprise Manager to allow me to see
more than one database at a time because of the "one -user-one
-database" problem.
Does anyone know if there is anyway i can set up Enterprise Manager to
get round this problem?
Thank you in advance!
EddyOne option is to register the server twice - create an alias
for the server and then register the second one with that
alias. You can use the second set of credentials to register
the second instance of the server with the alias.
So you'd end up with two server nodes pointing to the same
server but it would still be in one Enterprise Manager
console.
-Sue
On 16 Jan 2006 16:39:52 -0800, eddiekwang@.hotmail.com wrote:

>Hello,
>I ran into a strange situation. I need to access the same remote SQL
>server using 2 different user accounts at the same time. I can't seem
>to do it using Enterprise Manager.
>This is the first time I ran into this type of problem. I signed up for
>web hosting service with a company called Netnation. They have a
>strange policy- everytime, I create a database on their MS SQL server,
>they give me a new user account to access the new database. so if i own
>2 databases, then i will have to use 2 user names for the databases.
>each user name can only access one database.
>I am have problem configuring my Enterprise Manager to allow me to see
>more than one database at a time because of the "one -user-one
>-database" problem.
>Does anyone know if there is anyway i can set up Enterprise Manager to
>get round this problem?
>Thank you in advance!
>Eddy|||Sue,
Thanks for the reply. I already tried registering the server twice but
it didn't let me. I can't remember the specifics of the error message.
Did it ever work for you?
Eddy|||Hi Eddy,
Yes...worked fine. You need to have it registered under a
different name than the current registration. That's why I
said to create an alias first. Then register the alias. You
probably tried to register it twice with the same name.
-Sue
On 20 Jan 2006 12:34:49 -0800, eddiekwang@.hotmail.com wrote:

>Sue,
>Thanks for the reply. I already tried registering the server twice but
>it didn't let me. I can't remember the specifics of the error message.
>Did it ever work for you?
>Eddy

Access odbc linked table -SQL Server

I have users running an Access 97 application to update records in a SQL
Server 2000 database, per an odbc linked table. After modifying a record
from within the Access application, the linked table shows the updated
record in Access; but, sometimes, the change does not propagate to the table
in SQL Server. How can that be? Exactly when does an update commit to the
SQL Server table? Thanx.
Hi Vince,
May be IMPLICIT_TRANSACTION is SET in the database.
You can run DBCC USEROPTIONS, to verify the same.
If it is on, you need to understand the implications of turning it off.
Thanks
Yogish

Access odbc linked table -SQL Server

I have users running an Access 97 application to update records in a SQL
Server 2000 database, per an odbc linked table. After modifying a record
from within the Access application, the linked table shows the updated
record in Access; but, sometimes, the change does not propagate to the table
in SQL Server. How can that be? Exactly when does an update commit to the
SQL Server table? Thanx.Hi Vince,
May be IMPLICIT_TRANSACTION is SET in the database.
You can run DBCC USEROPTIONS, to verify the same.
If it is on, you need to understand the implications of turning it off.
Thanks
Yogish|||You could set it up using a view and a linked server rather than a linked ta
ble. That should query it real time. So you'd have this
Select * from
OPENQUERY(
LINKEDSERVER,
'SELECT * FROM TBL_NAME')
I think that'd be a good work around

Access odbc linked table -SQL Server

I have users running an Access 97 application to update records in a SQL
Server 2000 database, per an odbc linked table. After modifying a record
from within the Access application, the linked table shows the updated
record in Access; but, sometimes, the change does not propagate to the table
in SQL Server. How can that be? Exactly when does an update commit to the
SQL Server table? Thanx.Hi Vince,
May be IMPLICIT_TRANSACTION is SET in the database.
You can run DBCC USEROPTIONS, to verify the same.
If it is on, you need to understand the implications of turning it off.
Thanks
Yogish

Access odbc linked table -SQL Server

I have users running an Access 97 application to update records in a SQL
Server 2000 database, per an odbc linked table. After modifying a record
from within the Access application, the linked table shows the updated
record in Access; but, sometimes, the change does not propagate to the table
in SQL Server. How can that be? Exactly when does an update commit to the
SQL Server table? Thanx.
Hi Vince,
May be IMPLICIT_TRANSACTION is SET in the database.
You can run DBCC USEROPTIONS, to verify the same.
If it is on, you need to understand the implications of turning it off.
Thanks
Yogish
|||You could set it up using a view and a linked server rather than a
linked table. That should query it real time. So you'd have this
Select * from
OPENQUERY(
LINKEDSERVER,
'SELECT * FROM TBL_NAME')
I think that'd be a good work around
CecilCable
Posted via http://www.webservertalk.com
View this thread: http://www.webservertalk.com/message922826.html

access multiple sqlserver database using VB

How can i access multiple sqlserver database using VB
eg. insert 1 record in a database from other databse.Create a linked server in the database that your VB app logs into, and use that via a four part name.

-PatP