Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Tuesday, March 27, 2012

Database snapshot SQL Server 2005

Hello Every

I have a problem withASP.NET connect toDatabase Snapshot SQL Server 2005.

Step One: I create database snapshot.

Step Two: I want to use ASP.NET to Database Snapshot that create already. But I don't know connection string to database snapshot.

Please help me .....................

Thank You,

I also have the same problem as follows:

The first execute of SQL Server 2005 tasks to creates the snapshot as follows:

USE Master;
GO
IF EXITS (SELECT name FROM sys.database WHERE name = "N'source_system_snapshot_extract')
BEGIN
DROP DATABASE [source_system_snapshot_extract]
END
GO
CREATE DATABASE source_system_snapshot_extract ON
('C:\Test\source_system_snapshot_extract.ss)
AS SNAPSHOT OF source_system
GO

The second I want code in the ASP.NET to connect to the database snapshot replication above

Please post your example code if anyone can solve this problem.

|||

In the ASP.NET from the code design , i write the code as follow:

Imports Microsoft.SqlServer.Dts.Runtime

Public Sub Main()

Dim Constr$=Dts.connections("Source_System").connectionstring

If not Constr.contain("Initial Catalog=Source_System") then

Dts.taskresult=dts.results.failure

return

Endif

Dts.connections("Source_System").connectionstring=Dts.connections("Source_System").connectionstring.replace("Initial Catalog=Source_System", ("Initial Catalog=Source_System_Snapshot_Extract")

Dts.taskresult=dts.results.Success

End sub

The code above does not response correctly to have the database snapshot connect to asp.net

However ,DTS does not show up in code.

Please held me to resolve this .

|||

With your above code, I have write the same code using the Visual Studion IDE, then I have added a reference as follows:

Microsoft.SqlServer.ManagedDTS.DLL

To add the reference above, it is in order to create using statement as discussed in the above code, but it is not possible to display the right statement. I think someone in Microsoft with SQL Server 2005 Specialist will help us to code this. The crucial help from Microsoft will be usefull the programmers over the world.

|||

Thanks alot that you try to help me.

but i still got a problem i can't connect to database snapshot with VB.NET.

Microsoft said that we can do database with database snapshot . but try to find any sample on the internet websit i can't found about that problem , How to connect to database snapshot with VB.NET.

i don't belive in that The Microsoft speak a lie all of customers that support his product, but i am not sure untill he solve this problem , to indicate

me to know or all of programmer in the world.

i hope that someone in Microsoft with SQL Server 2005 Specialist will help this.

|||

I try helping to solve this problem, but i have still not yet find the solution. I think that there will be another specialist like moderator, contributor or commentator of this web site will help you to solve this problem. I have read some technical notes regarding to your needs I hope SQL Server Specialist from Microsoft will assist you to resolve your problem.

If Database Snapshot Replication has no connection with VB.NET, I believe that the SQL Server 2005 programmer within Microsoft was not hosted this project in SQL Server 2005 Project.

|||

I understand your concepts related to the database snapshot to create just the read-only databases for viewing the reports. This is no need to use the original database with SQL Server 2005 install to come along with your backage, but I have some link to talk about database snapshot, but this web is not talking the database snapshot connecting with VB.NET (http://articles.techrepublic.com.com/5100-9592_11-6146916.html), (http://www.code-magazine.com/article.aspx?quickid=0311101&page=4), also see this link:http://sqljunkies.com/WebLog/marathonsqlguy/archive/2006/05.aspx. I think there is no way to code from VB.NET to connect the database snapshot out of the original database.

I probably am poor with this coding, I hope someone in this site will save you to code this and attached with nice example project.

|||

?????????????????? ?????????????????????????????????????http://www.c-sharpcorner.com/UploadFile/paulyau/DBOpsInADOPA11302005071252AM/DBOpsInADOPA.aspx

|||

Please read this link:https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1149179&SiteID=1 , I think it is useful for you.

|||

Also see this link:http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=63581&SiteID=17

|||

This is also useful link:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1458445&SiteID=1

|||

See this help you:http://msdn2.microsoft.com/zh-cn/library/microsoft.sqlserver.management.smo.database.isdatabasesnapshot.aspx

|||

Is this link help you:http://support.microsoft.com/kb/319649 orhttp://support.microsoft.com/kb/319648/

|||

This topic is still error. Please help me

Sunday, March 25, 2012

Database size on IIS 5

Good Morning,
I have a web service developed using vb.net. The web
service returns xml from selected data (SQL SELECT
statement using XML AUTO) from SQL Server. The web service
runs properly on smaller databases on both IIS 5 (Windows
2000 Server) and IIS 6 (Windows 2003 Server), but returns
an error when run against larger databases on IIS 5. The
error has been 'out System.OutOfMemoryException'.
I am trying to figure out the difference between IIS 5 and
IIS 6 which is causing this, and a solution.I guess the database is too big for IIS5, so it can not run.
After all, when IIS5 design, no one can image a big database like we use
today.
I think If I am you, I will catch this exception and give the customer some
information to update the IIS.
Last: This is a problem of IIS, you may ask there

Database size on IIS 5

Good Morning,
I have a web service developed using vb.net. The web
service returns xml from selected data (SQL SELECT
statement using XML AUTO) from SQL Server. The web service
runs properly on smaller databases on both IIS 5 (Windows
2000 Server) and IIS 6 (Windows 2003 Server), but returns
an error when run against larger databases on IIS 5. The
error has been 'out System.OutOfMemoryException'.
I am trying to figure out the difference between IIS 5 and
IIS 6 which is causing this, and a solution.I guess the database is too big for IIS5, so it can not run.
After all, when IIS5 design, no one can image a big database like we use
today.
I think If I am you, I will catch this exception and give the customer some
information to update the IIS.
Last: This is a problem of IIS, you may ask there:)

Monday, March 19, 2012

Database security on a Local Network

This is regarding general protection of a database hosted on a network. I am developing a database application for my college library using VB.NET, that will reside on a network.
For some reasons, I did not want to hardcode the Database location in the application. Instead, when a user logs in, he can choose the database location using a folder browser control, if the location has changed.

Now, I realize that for this, I have to put the database in a shared folder, which makes it quite vulnerable. Having pondered over the problem for sometime, a solution that comes to my mind is to place a Text file in the same shared folder that always contains the correct path of the database. When a user chooses that folder, I will read the actual path of the database from the text file, and move the database to a non-shared folder.
I haven't yet implemented this approach, but felt it better to consult someone before. So, would this approach work, and is it a good idea.
For information purposes, I consider it important to mention that the database is in MS Access. I know this is not a place for discussing it, but this is a general security concern. So, I thought
people would not mind answering it....


Hi,

how aout securing the MDB file using the appropiate NTFS permissions and eventually additional Access password security or using an ldb file ? I don′t know if there can be concurrent users on the database, but coyping the database file to a shared folder will allow other users also to copy the file to another folder and working on it, for you having the trouble to bring the data together afterwards.

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||More than the problem of bringing it together afterwards, I am worried about someone manipulating it mischievously. That's why I thought of putting the database in a non-shared folder on the server and a text file in a shared folder, which will always

contain the correct path of the DB on the server.

So, when a user logs in, he will select the path of the text file. As he

will do so with a folder chooser, he will not know that the folder contains a

text file & not the actual DB. Internally, I will read the database path from

that file in my application, & use that path to construct the connection

string...

I think this approach will shield the database from direct access on the network, using an explorer etc.

I already have Access password security, but still I dont want the database to be directly accessible on the network.
Can you elaborate a bit more on securing the Database on the server with NTFS permissions, in a way that my application can still access & manipulate it?|||

One thing, you cannot perform such move/copy with a SQL Server database as that will be in exclusive use of SQLengine.

Refer to KBA http://support.microsoft.com/kb/295234, http://support.microsoft.com/kb/307901 and link http://vb123.com/toolshed/links/map/opr.htm for more information.

|||There are two things I will mention again here...
1) My database is in Access
2) And, I am not moving the Database at run-time. The database will remain in its non-shared folder. And there will be a text file, that will act as a sort of pointer to the database location for my application, as I will read the DB path from the text file.|||

I suggest posting this question on a Microsoft Access or Microsoft Visual Basic forum instead of this one. This forum is used for posting questions related to Microsoft SQL Server security features, as you observed, and your question is Access specific.

Thanks
Laurentiu

|||

Hi,

You can do this well with NTFS permission with Read right for everyone in Group so that everyone can read the database files (this will not make user to able to copy files/folder too) , and give write/modify permission to specific users who need to insert/update/delete records in your access database. Refer www.windowsecurity.com/articles/Understanding-Windows-NTFS-Permissions.html to understand NTFS permission properly and with Advance you may restrict Take Ownership/traversing etc.

HTH

Hemantgiri S. Goswami

Database security design with ASP.net and form-based authentication

I'm setting up an ASP.Net intranet application with a SQL Server 2000
database. The application uses form-based authentication which is supported
by the following tables: User, Role, UserRole (where each user is assigned
specific roles). The system will have several different roles and users can
belong to multiple roles. As an example, let's say I have the following
roles: data entry, guest/view only, admin, report viewer. I'm guessing now
the system will have about 20 unique users. I've figured out how to
implement the role-based part on ASP.Net, but I'm stuck trying to decide the
best way to secure my database tables and stored procedures.
We're on a Novell network, so I'm using SQL Server authentication. At it's
simplest, I could just have one login for my database and lock down all the
tables and stored procedures to that one login. I'd like to have the
security a little tighter, though, so that only users who belong to the
administrative role can access the administrative procedures, only data
entry members can access the data entry procedures, etc.
I've thought of the following scenarios, but none makes me happy:
1) Create a SQL Server login for each user of the application and assign
them to roles. Then lock the tables and procedures down to the appropriate
roles.
I don't want to do this because I want an administrative user to be able to
create new application users through the Web application. This wouldn't be
possible as I don't have rights to create new SQL Server logins. I'd have
to go to my DB Admin each time we want to add a new user, which isn't really
acceptable.
2) Use SQL application roles to secure tables and procedures. We've used
these in other applications, but I'd like to stay away from them since
connection pooling doesn't work with them.
3) Use a set number of SQL Logins for each pre-defined role (data entry,
guest, admin, report viewer) and grant those logins permission to tables and
procedures as appropriate. I think this is my favorite method right now,
but then I'm not sure how to manage the multiple usernames and passwords.
Where do I store them and how does the application decide which one to use?
This is where maybe this question is more appropriate in an ASP.Net group,
but I thought I'd try here first.
I'm wondering what other people have done in this scenario?
Thanks,
Diane Y.Since you already have forms-based security, why not use a single SQL login
for all database access?
Hope this helps.
Dan Guzman
SQL Server MVP
"Diane Y" <diane.yocom@.spam.seattle.gov> wrote in message
news:OUiKBQwQGHA.5500@.TK2MSFTNGP12.phx.gbl...
> I'm setting up an ASP.Net intranet application with a SQL Server 2000
> database. The application uses form-based authentication which is
> supported
> by the following tables: User, Role, UserRole (where each user is assigned
> specific roles). The system will have several different roles and users
> can
> belong to multiple roles. As an example, let's say I have the following
> roles: data entry, guest/view only, admin, report viewer. I'm guessing
> now
> the system will have about 20 unique users. I've figured out how to
> implement the role-based part on ASP.Net, but I'm stuck trying to decide
> the
> best way to secure my database tables and stored procedures.
> We're on a Novell network, so I'm using SQL Server authentication. At
> it's
> simplest, I could just have one login for my database and lock down all
> the
> tables and stored procedures to that one login. I'd like to have the
> security a little tighter, though, so that only users who belong to the
> administrative role can access the administrative procedures, only data
> entry members can access the data entry procedures, etc.
> I've thought of the following scenarios, but none makes me happy:
> 1) Create a SQL Server login for each user of the application and assign
> them to roles. Then lock the tables and procedures down to the
> appropriate
> roles.
> I don't want to do this because I want an administrative user to be able
> to
> create new application users through the Web application. This wouldn't
> be
> possible as I don't have rights to create new SQL Server logins. I'd have
> to go to my DB Admin each time we want to add a new user, which isn't
> really
> acceptable.
> 2) Use SQL application roles to secure tables and procedures. We've used
> these in other applications, but I'd like to stay away from them since
> connection pooling doesn't work with them.
> 3) Use a set number of SQL Logins for each pre-defined role (data entry,
> guest, admin, report viewer) and grant those logins permission to tables
> and
> procedures as appropriate. I think this is my favorite method right now,
> but then I'm not sure how to manage the multiple usernames and passwords.
> Where do I store them and how does the application decide which one to
> use?
> This is where maybe this question is more appropriate in an ASP.Net group,
> but I thought I'd try here first.
> I'm wondering what other people have done in this scenario?
> Thanks,
> Diane Y.
>|||That's actually the way I have it setup now and it's what I've mostly done
in the past. I just really liked how, when I used multiple application
roles, I was able to give only certain roles permission to certain stored
procedures. So, I was just wondering what others have done...
Diane
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:eoNTQdyQGHA.5552@.TK2MSFTNGP10.phx.gbl...
> Since you already have forms-based security, why not use a single SQL
login
> for all database access?
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Diane Y" <diane.yocom@.spam.seattle.gov> wrote in message
> news:OUiKBQwQGHA.5500@.TK2MSFTNGP12.phx.gbl...
assigned[vbcol=seagreen]
have[vbcol=seagreen]
used[vbcol=seagreen]
now,[vbcol=seagreen]
passwords.[vbcol=seagreen]
group,[vbcol=seagreen]
>|||> So, I was just wondering what others have done...
I usually opt for option #1 (individual logins/database role membership) for
intranet apps, . This allows SQL Server to control security from both
within and outside your application. Unfortunately, this isn't an option
for you due to the reasons you stated.
Application roles vs. role-based logins are similar approaches. These work
well when a user belongs to a single role so that you can use the same
security context for a given user's database access. However, this method
is problematic in your case because a user can belong to multiple roles
(cumulative permissions). The difficult question is how you decide which
database security context to enable when a user belongs to multiple roles
and multiple roles are associated with a particular application feature.
For example, if user Mary belongs to both DataEntry and ReportViewer roles
and your security is such that either role can view a report, which role
should be used as the database security context?
As long as you can define your business rules for identifying the
appropriate database security context, the implementation is easy. All you
need to do is store the application role name or login along with the
password (encrypted) in your Role table. You can then use that for database
access.
IMHO, the single login approach is best in your situation since you don't
want DBA involvement for security administration.
Hope this helps.
Dan Guzman
SQL Server MVP
"Diane Y" <diane.yocom@.spam.seattle.gov> wrote in message
news:e8WPEH5QGHA.2300@.TK2MSFTNGP11.phx.gbl...
> That's actually the way I have it setup now and it's what I've mostly done
> in the past. I just really liked how, when I used multiple application
> roles, I was able to give only certain roles permission to certain stored
> procedures. So, I was just wondering what others have done...
> Diane
> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
> news:eoNTQdyQGHA.5552@.TK2MSFTNGP10.phx.gbl...
> login
> assigned
> have
> used
> now,
> passwords.
> group,
>

Friday, February 24, 2012

database Question..

hi everyone..

im using asp.net with vb.net.

i have a situation, there are two drop down list, 1)Car Model 2) Car Colours. A set of specific colours would fill up the second dropdown list based on the Car Model choosen on the first drop down list.

my question is how do i create a database table that enables me to extract the specific colours based on the car model chosen?.How to create database to accomodate this kinda specific info?

hope to get some feedback here.thank you.Hi

There are two ways to go about this and I suppose the option you choose to take will depend on how normalized you want your database to be.

OPTION 1:
----

One Entry for each individual car in the car table
Car Table
--> CarID
--> CarDescription

One entry for each combination of car/colour in the colour table.
Colour Table
--> ColourID
--> ColourDescription
--> CarID (Foreign Key)

Thus you might have 15 entries for the colour blue, but each of these entries will have a different CarID (i.e. the cars that are available in blue). When the car selected is then say the car with CarID 10, populate the colour dropdown with each colour from colour dropdown that has a CarID of 10.

OPTION 2:
----

One Entry for individual car in the car table
Car Table
--> CarID
--> CarDescription

One Entry for individual colour in the colour table
Colour Table
--> ColourID
--> ColourDescription

And then a third table that maps CarID's to ColourID's:
Car_Colour Table
--> CarID (Foreign Key)
--> ColourID (Foreign Key)

Now when CarID 10 is selected in the car dropdown, populate the colour dropdown with each colour that is mapped to CarID 10 in the Car_Colour table...

HTH|||Dear Daily...

Thanks a heap!!!...really appreicate it..:)

Sunday, February 19, 2012

Database Properties

is there anyway to retrieve the database properties and display in an asp.net web form as a quick over view rather than logging onto the server to check, items such as size, space available, last backup data etc?

Cheers

I have managed to get the database size using :

EXEC sp_MSforeachtable @.command1=EXEC sp_spaceused

|||

Hi,

Haven't tried it but you should be able to use theMicrosoft.SqlServer.Management.Smo to do so:

Here's an example :

http://www.aspfree.com/c/a/MS-SQL-Server/Retrieving-SQL-Server-2005-Database-Info-Using-SMO-Database-Info-Table-Info/1/

HTH,
Suprotim Agarwal

--
http://www.dotnetcurry.com
--

Database problems with loging into my site

I have build a ASP.NET website with a login form. I can create an account but I am not able to login into the site. I have checked the connection string. I have changed the database folder and moved files around to get the database runing from a different folder but it still wont work. ThanksTim

Which version of ASP.NET are you working with?

Which version of SQL Server are you working with?

Try copying the contents of your connection string to a expty text file, rename the file to X.UDL and double click on it. The connection dialog should appear. Click the test button.

|||

i am using VWD 2005 Express and I am hosting it using IIS 5.1 (Windows XP) as my server. I am working on Workframe 2

Database problems

I am new to ASP.Net so I have a bunch of beginner problems here. My first BIG one is that every time I try and make a database connection in my code, I get

"Login failed for user 'sa'. Reason: Not associated with trusted SQL Server connection"

I know 'sa' is a valid user for the database, and I have retreived data other ways through swlDataAdapters, sqlConnections, and Datasets from design view. Any idea why I cannot expictitly connection to my DB in my code?? Or is there something stupid and small that I am overlooking?

Any help will be greatly appreciated.::Or is there something stupid and small that I am overlooking?

It is, but given the maount of people stumbling over it - you are not alone.

SQL Server simply is set not to look for the password but to use Windows integrated authentication ONLY. In this case access is checked against the account asp.net is running under, which has not enough security rights.

You need to reconfigure SQL Server to use mixed mode authentication, so that the username/password parts of the connection string actually have a real meaning. Especially the password part.

Friday, February 17, 2012

Database Permission

Could someone please tell me how I can trap permission errors in
vb.net on a stored procedure:
ie. Execute permission denied on object 'sel_mytable', database
'mydatabase', owner 'dbo'

I would like to print a message like
response.write("You don't have permission to select on this table") as
opposed to the cryptic message I am receiving.

Thanks in advance
Julie BarnetYou can trap a SqlException and translate the error as desired in your code.
VB.Net WinForm example:

Try
sqlCommand.ExecuteReader()
Catch ex As SqlException
Dim PermissionError As Boolean = False
For Each sqlError As SqlError In ex.Errors
If sqlError.Number = 229 Then
PermissionError = True
Exit For
End If
Next sqlError
If PermissionError = True Then
MessageBox.Show("You don't have permission to select on this
table")
Else
MessageBox.Show("Unexpected error: " & ex.ToString())
End If
End Try

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Julie Barnet" <barnetj@.pr.fraserpapers.com> wrote in message
news:438e1811.0312081052.d233a1f@.posting.google.co m...
> Could someone please tell me how I can trap permission errors in
> vb.net on a stored procedure:
> ie. Execute permission denied on object 'sel_mytable', database
> 'mydatabase', owner 'dbo'
> I would like to print a message like
> response.write("You don't have permission to select on this table") as
> opposed to the cryptic message I am receiving.
> Thanks in advance
> Julie Barnet|||I am databinding a datagrid. I tried that and it still doesn't seem
to work. I will paste my code...

Is there something I'm missing?

Public Function BindGrid(ProcName as String, myDataGrid as
DataGrid, cmd as SqlCommand, con as SqlConnection) as Integer
Dim ds As DataSet
Dim da As new SqlDataAdapter()

Try

cmd.CommandText = ProcName
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = con

da.Selectcommand = cmd

ds = new DataSet()
da.Fill(ds, "MyTable")

myDataGrid.DataSource=ds.Tables("MyTable").DefaultView
myDataGrid.DataBind()
return ds.Tables("MyTable").Rows.Count

catch exp as SqlException
HttpContext.Current.Response.Write("Exception3")

End Try
End Function|||I ran your code and got the "Exception3" message. What symptoms are you
getting?

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Julie Barnet" <barnetj@.pr.fraserpapers.com> wrote in message
news:438e1811.0312090444.3e7dd4ab@.posting.google.c om...
> I am databinding a datagrid. I tried that and it still doesn't seem
> to work. I will paste my code...
> Is there something I'm missing?
> Public Function BindGrid(ProcName as String, myDataGrid as
> DataGrid, cmd as SqlCommand, con as SqlConnection) as Integer
> Dim ds As DataSet
> Dim da As new SqlDataAdapter()
> Try
> cmd.CommandText = ProcName
> cmd.CommandType = CommandType.StoredProcedure
> cmd.Connection = con
> da.Selectcommand = cmd
> ds = new DataSet()
> da.Fill(ds, "MyTable")
> myDataGrid.DataSource=ds.Tables("MyTable").DefaultView
> myDataGrid.DataBind()
> return ds.Tables("MyTable").Rows.Count
>
> catch exp as SqlException
> HttpContext.Current.Response.Write("Exception3")
> End Try
> End Function

Tuesday, February 14, 2012

Database owner change

Hello,

I'm using tableadapters in VWD 2005 Express to link our ASP.NET application to a SQL Server 2000 database. Initially, I used Database Explorer to drop tables into the DataSet object, which picks up the owner of the tables from the database.

Recently, we had to change the owner of all objects in the database, including tables and stored procedures. When we run our application it chokes on stored procedures because the owner of the SP's has changed.

My question is: how can I update tables and tableadapters in the DataSet to reflect the change in owner, without having to recreate everything in DataSet?

Confused

We resolved this.