Showing posts with label newbie. Show all posts
Showing posts with label newbie. Show all posts

Thursday, March 29, 2012

attach db MS SQL 2000 .BAK with enterprise manager

hello everyone
i am the worst newbie that exists,,.. and on top my english is terrible !
i hope someone can help me :)
I need to attach .BAK db MS SQL 2000 with enterprise manager
I have a file de db sqlserver 2000 called hello_db_20060410man.bak
my last host has transfered to me .i am not hosted anymore and trying to attach my sqldb to use on IIS on my computer
but..... enterprise manager asks me for files in
.mdf and .log
How can I transform this .bak ?
when i try to restore it enterprise i CANNOT include it
message is that this ,bak is not a sql file !!!
Thanks in advance for your help

Quote:

Originally Posted by julia777

hello everyone
i am the worst newbie that exists,,.. and on top my english is terrible !
i hope someone can help me :)
I need to attach .BAK db MS SQL 2000 with enterprise manager
I have a file de db sqlserver 2000 called hello_db_20060410man.bak
my last host has transfered to me .i am not hosted anymore and trying to attach my sqldb to use on IIS on my computer
but..... enterprise manager asks me for files in
.mdf and .log
How can I transform this .bak ?
when i try to restore it enterprise i CANNOT include it
message is that this ,bak is not a sql file !!!
Thanks in advance for your help


Hi

Where you get this "hello_db_20060410man.bak" this file seems s BACKUP file ,you have restore this file then you will get the .mdf and .log files

RESTORE DATABASE <DESIRE DATABASE NAME>
FROM DISK = '<PATH OF WHERE hello_db_20060410man.bak RESIDES>'
WITH MOVE '<DAT FILENAME>' TO '<PATH WHERE YOU WANT .MDF FILE>',
MOVE 'LOGFILE NAME' TO '<PATH WHERE YOU WANT .LDF FILE>'

EXAMPLE:

RESTORE DATABASE TESTDB1 FROM DISK = 'C:\TEST\TESTDB.BAK'
WITH MOVE 'TESTDB_DAT' TO 'C:\TEST\TESTDB.MDF',
MOVE 'TESTDB_LOG' TO 'C:\TEST\TESTDB.LDF'|||THANKS a lot sponguru_dba :))
it seems to work i have ot my 2 files..
however.. seems i am having a problem to log into yhe site on my IIS :((
i will try again and let you know if you dont mind :)
Thanks again
Julia

Tuesday, March 27, 2012

Attach database problem

Hi Folks
I am a newbie trying to attach an MSDE dbf from a whatever.mdf and
whatever.ldf files. I keep getting an error that I can't attach the database
to the same name as an existing database.
Any help would be appreciated?
Danny
Hello,
Looks like the database name you specify in the atatch database is already
in the same server instance. Execute SP_HELPDB and make sure that
the database you specy is already not there.
Thanks
Hari
"Danny" <lane.dj@.gmail.com> wrote in message
news:OZdKYqZaHHA.1220@.TK2MSFTNGP03.phx.gbl...
> Hi Folks
> I am a newbie trying to attach an MSDE dbf from a whatever.mdf and
> whatever.ldf files. I keep getting an error that I can't attach the
> database to the same name as an existing database.
> Any help would be appreciated?
> Danny
>

Sunday, March 25, 2012

attach / detach newbie question

I've looked at all the microsoft articles relating to moving a database from
one location to another using the attach/detach commands and I have one
question. Are those commands typed from a command prompt or do I need to run
these from SQL manager?
Hi,
You can execute those commands from
1. Selecting Query Analyzer from SQL Program groups. (issue the user name
and password to login)
Once you go inside the Query analyzer you could execute all TSQL
commands which includes the detach and attach db commands.
2. FROM command prompt execute OSQL
OSQL -Usa -Ppassword -S <SQL Servername> (enter)
This will go to a SQL prompt; there execute those sp_detach_db and
sp_attach_db commands.
Thanks
Hari
SQL Server MVP
"JL Adamson" <JLAdamson@.discussions.microsoft.com> wrote in message
news:8886FE74-93B2-4FD9-997F-25884FA0F953@.microsoft.com...
> I've looked at all the microsoft articles relating to moving a database
> from
> one location to another using the attach/detach commands and I have one
> question. Are those commands typed from a command prompt or do I need to
> run
> these from SQL manager?

attach / detach newbie question

I've looked at all the microsoft articles relating to moving a database from
one location to another using the attach/detach commands and I have one
question. Are those commands typed from a command prompt or do I need to run
these from SQL manager?Hi,
You can execute those commands from
1. Selecting Query Analyzer from SQL Program groups. (issue the user name
and password to login)
Once you go inside the Query analyzer you could execute all TSQL
commands which includes the detach and attach db commands.
2. FROM command prompt execute OSQL
OSQL -Usa -Ppassword -S <SQL Servername> (enter)
This will go to a SQL prompt; there execute those sp_detach_db and
sp_attach_db commands.
Thanks
Hari
SQL Server MVP
"JL Adamson" <JLAdamson@.discussions.microsoft.com> wrote in message
news:8886FE74-93B2-4FD9-997F-25884FA0F953@.microsoft.com...
> I've looked at all the microsoft articles relating to moving a database
> from
> one location to another using the attach/detach commands and I have one
> question. Are those commands typed from a command prompt or do I need to
> run
> these from SQL manager?

attach / detach newbie question

I've looked at all the microsoft articles relating to moving a database from
one location to another using the attach/detach commands and I have one
question. Are those commands typed from a command prompt or do I need to run
these from SQL manager?Hi,
You can execute those commands from
1. Selecting Query Analyzer from SQL Program groups. (issue the user name
and password to login)
Once you go inside the Query analyzer you could execute all TSQL
commands which includes the detach and attach db commands.
2. FROM command prompt execute OSQL
OSQL -Usa -Ppassword -S <SQL Servername> (enter)
This will go to a SQL prompt; there execute those sp_detach_db and
sp_attach_db commands.
Thanks
Hari
SQL Server MVP
"JL Adamson" <JLAdamson@.discussions.microsoft.com> wrote in message
news:8886FE74-93B2-4FD9-997F-25884FA0F953@.microsoft.com...
> I've looked at all the microsoft articles relating to moving a database
> from
> one location to another using the attach/detach commands and I have one
> question. Are those commands typed from a command prompt or do I need to
> run
> these from SQL manager?

Monday, February 13, 2012

ASP.net newbie trying to build a forum

Hi,
I'm an absolute newbie to asp.net... and recently got a start by visiting the beginner developer learning center at the msdn website. I have gone through all of the videos, and now I'm trying to build my first asp.net website... which would be an imaginary forum. I have the following tables in the database used in my application:
Categories
CategoryID int
CategoryName nvarchar(50)
CategoryDescription nvarchar(200)
Threads
ThreadID bigint(8)
CategoryID int
Subject nvarchar(50)
PostedDate datetime
PostedBy nvarchar(10)
Messages
MessageID bigint(8)
ThreadID bigint(8)
MessageBody nvarchar(200)
ReplyToID bigint(8)
User char(10)
You get the idea about what I'm trying to do.
Now, I have successfully written Categories.aspx, and Threads.aspx to display the sample data which I added. The problem is with the messages.aspx. I have no idea how to output data which would give me a means to sort and indent the messages according to the way the users would reply. I mean... users might reply to a message, and another might reply to the reply of that message... creating one big hierarchical mess. So I'm stuck... I can't build my imaginary forum.
Anyone experienced with writing code for forums with SQL server as the back end?
I am hoping to learn some new things about SQL server... maybe... XML? Which would solve my problem? I am already a little familiar with XML and XSL.
Many thanks in advance.
Mohamed Shafiee.
Hello Mohamed,
While this isn't an ASP.NET focused group, and while I don't believe SQLXML
is going to buy you anything here, here's an example that might get you started.
use scratch
go
-- make the message table
drop table dbo.messages
go
create table dbo.messages(
MessageID bigint primary key,
ThreadID bigint not null,
MessageBodynvarchar(200) not null,
ReplyToID bigint null foreign key references dbo.messages(messageID),
PostedBy varchar(50) not null default suser_sname())
go
set nocount on
go
-- some dummy messages
insert into dbo.messages(messageID,threadID,messageBody,ReplyT oID)
values (1,1,'1',null)
insert into dbo.messages(messageID,threadID,messageBody,ReplyT oID)
values (2,1,'1-1',1)
insert into dbo.messages(messageID,threadID,messageBody,ReplyT oID)
values (3,1,'1-2',1)
insert into dbo.messages(messageID,threadID,messageBody,ReplyT oID)
values (4,1,'1-2-1',3)
insert into dbo.messages(messageID,threadID,messageBody,ReplyT oID)
values (5,1,'1-2-2',3)
insert into dbo.messages(messageID,threadID,messageBody,ReplyT oID)
values (6,1,'1-2-2-1',5)
insert into dbo.messages(messageID,threadID,messageBody,ReplyT oID)
values (7,1,'1-2-2-2',5)
insert into dbo.messages(messageID,threadID,messageBody,ReplyT oID)
values (8,1,'1-2-1-1',4)
go
-- @.tid bigint is the ThreadID selected
-- @.rtm bigint is the Message user wants to reply to
drop procedure dbo.GetThreadForMessage
go
create procedure dbo.GetThreadForMessage(@.tid bigint, @.rtm bigint)
as begin
-- Get all the messages in this thread, "nested" by level
;with cte1 as (
select m1.messageID,m1.threadID,m1.MessageBody,m1.ReplyTo ID,m1.PostedBy,
cast(0 as int) as lvl
from dbo.messages m1
where m1.threadID = @.tid and m1.ReplyToID is null
union all
select mr.messageID,mr.threadID,mr.MessageBody,mr.ReplyTo ID,mr.PostedBy,
cte1.lvl + 1
from dbo.messages mr
join cte1 on mr.ReplyToID = cte1.MessageID
where mr.threadID = @.tid),
-- Get the reponses leading to the replying-to message.
cte2 as (
select replyToID from dbo.messages where messageID = @.rtm
union all
select m2.replyToID from dbo.messages m2
join cte2 on m2.messageID = cte2.replyToID
)
-- Last Message in thread
select * from cte1
where cte1.messageID = @.rtm
union all
-- Other messages in thread
select * from cte1
where cte1.messageID in (select ReplyToID from cte2)
union
-- Base message
select * from cte1 where cte1.replyToID is null
order by cte1.lvl desc
for xml path('message'),root('messages'),type
end
go
exec GetThreadForMessage 1,7
go
Thanks!
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/

ASP.net newbie trying to build a forum

Hi,
I'm an absolute newbie to asp.net... and recently got a start by visiting th
e beginner developer learning center at the msdn website. I have gone throug
h all of the videos, and now I'm trying to build my first asp.net website...
which would be an imaginary forum. I have the following tables in the datab
ase used in my application:
Categories
CategoryID int
CategoryName nvarchar(50)
CategoryDescription nvarchar(200)
Threads
ThreadID bigint(8)
CategoryID int
Subject nvarchar(50)
PostedDate datetime
PostedBy nvarchar(10)
Messages
MessageID bigint(8)
ThreadID bigint(8)
MessageBody nvarchar(200)
ReplyToID bigint(8)
User char(10)
You get the idea about what I'm trying to do.
Now, I have successfully written Categories.aspx, and Threads.aspx to displa
y the sample data which I added. The problem is with the messages.aspx. I ha
ve no idea how to output data which would give me a means to sort and indent
the messages according to the way the users would reply. I mean... users mi
ght reply to a message, and another might reply to the reply of that message
.. creating one big hierarchical mess. So I'm stuck... I can't build my ima
ginary forum.
Anyone experienced with writing code for forums with SQL server as the back
end?
I am hoping to learn some new things about SQL server... maybe... XML? Which
would solve my problem? I am already a little familiar with XML and XSL.
Many thanks in advance.
Mohamed Shafiee.Hello Mohamed,
While this isn't an ASP.NET focused group, and while I don't believe SQLXML
is going to buy you anything here, here's an example that might get you star
ted.
use scratch
go
-- make the message table
drop table dbo.messages
go
create table dbo.messages(
MessageID bigint primary key,
ThreadID bigint not null,
MessageBody nvarchar(200) not null,
ReplyToID bigint null foreign key references dbo.messages(messageID),
PostedBy varchar(50) not null default suser_sname())
go
set nocount on
go
-- some dummy messages
insert into dbo. messages(messageID,threadID,messageBody,
ReplyToID)
values (1,1,'1',null)
insert into dbo. messages(messageID,threadID,messageBody,
ReplyToID)
values (2,1,'1-1',1)
insert into dbo. messages(messageID,threadID,messageBody,
ReplyToID)
values (3,1,'1-2',1)
insert into dbo. messages(messageID,threadID,messageBody,
ReplyToID)
values (4,1,'1-2-1',3)
insert into dbo. messages(messageID,threadID,messageBody,
ReplyToID)
values (5,1,'1-2-2',3)
insert into dbo. messages(messageID,threadID,messageBody,
ReplyToID)
values (6,1,'1-2-2-1',5)
insert into dbo. messages(messageID,threadID,messageBody,
ReplyToID)
values (7,1,'1-2-2-2',5)
insert into dbo. messages(messageID,threadID,messageBody,
ReplyToID)
values (8,1,'1-2-1-1',4)
go
-- @.tid bigint is the ThreadID selected
-- @.rtm bigint is the Message user wants to reply to
drop procedure dbo.GetThreadForMessage
go
create procedure dbo.GetThreadForMessage(@.tid bigint, @.rtm bigint)
as begin
-- Get all the messages in this thread, "nested" by level
;with cte1 as (
select m1.messageID,m1.threadID,m1.MessageBody,m1.ReplyToID,m1.PostedBy,
cast(0 as int) as lvl
from dbo.messages m1
where m1.threadID = @.tid and m1.ReplyToID is null
union all
select mr.messageID,mr.threadID,mr.MessageBody,mr.ReplyToID,mr.PostedBy,
cte1.lvl + 1
from dbo.messages mr
join cte1 on mr.ReplyToID = cte1.MessageID
where mr.threadID = @.tid),
-- Get the reponses leading to the replying-to message.
cte2 as (
select replyToID from dbo.messages where messageID = @.rtm
union all
select m2.replyToID from dbo.messages m2
join cte2 on m2.messageID = cte2.replyToID
)
-- Last Message in thread
select * from cte1
where cte1.messageID = @.rtm
union all
-- Other messages in thread
select * from cte1
where cte1.messageID in (select ReplyToID from cte2)
union
-- Base message
select * from cte1 where cte1.replyToID is null
order by cte1.lvl desc
for xml path('message'),root('messages'),type
end
go
exec GetThreadForMessage 1,7
go
Thanks!
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/

Sunday, February 12, 2012

ASP.NET DataGrid Problem

Hi,

As a relative newbie to SQL Server/ASP.NET I'm hoping someone here
can help with my problem. I'm developing a timesheet application in
ASP.NET C# using Visual Studio 2003 with a database built in MSDE.
One of my forms needs to return a simple list of resources from my
database. I have followed the guide on the MSDN libraries, but for
some reason I continuously get the same error message.

What I've done so far is Create the database, tables, and populate
with some sample data using using Server Explorer in Visual Studio. I have
connected to the database (using integrated security) and I am
trying to get the contents of the Resource table to appear on my
form. I have then created a DataAdapter (tested the connection, set
the SQL as a simple SELECT * from Resource, etc), which also generates an sqlConnection for me. To test this I have previewed the generated data, and it returns what I want, so I
have chosen to generate a DataSet of this. I am then trying to get
this data into a simple DataGrid. On the properties of the DataGrid
I have changed the DataSource to point at my Dataset. As I
understand it, I then have to add the following to my Page Load
section of my code.

sqlConnection1.Open();
this.sqlDataAdapter1.Fill(this.dsResource);
DataGrid1.DataBind();
sqlConnection1.Close();

The form builds fine, but when I browse to the particular form I get
the following error for the sqlConnection1.Open(); line. If I remove this line the error simply moves to the line below.

Exception Details: System.Data.SqlClient.SqlException: Cannot open
database requested in login 'SCMS'. Login fails. Login failed for
user 'AL-NOTEPAD\ASPNET'.

To me this is an error with my connection string. My database
instance is actually 'AL-NOTEPAD\VSDOTNET'. However the properties
for sqlConnection1 are pointing to the correct datasource. I do not
know why the application is looking for user 'AL-NOTEPAD\ASPNET'. It does not exist, to my knowledge. Do I need to grant access to this user? If so, how would I do it? Bearing in mind I am using MSDE, and do not have Enterprise Manager.

Any help with this would be greatly appreciated, as I get the same
error with my code for forms-based login...


Thanks in advance..

Hi there, welcome to the ASP.NET Forums!

The root of the problem is that Visual Studio will use *your* credentials to log in to the SQL Server and access the database when you are using integrated security. However, when you run the site through a web server, it will use the ASPNET account. And, as you are experiencing, the ASPNET account does by default have those needed permissions.

To solve this problem, you have 2 options. You can use impersonation in your web.config, so that your web application will impersonate whatever user you desire (which presumably has permissions to your SQL Server and database). Or, you can grant the needed permissions to the ASPNET account.

Seethis post for instructions on how to grant the needed permissions to the ASPNET account.|||

Hi,

Thanks for all the help, I've sorted the problem in the short term by
downloading an MSDE alternative to Enterprise Manager
(http://www.asql.biz/DbaMgr.shtm) and assigned the relevant access to
the ASPNET user account. The DataGrid now works.

Thanks again

Al