Showing posts with label cant. Show all posts
Showing posts with label cant. Show all posts

Tuesday, March 20, 2012

Adventure works database, I can't connect to the database

Database not found !

My web.config file has this bit of code:

<connectionStrings>

<add name="AppConnectionString1" connectionString="Data Source=&quot;.\SQLEXPRESS&quot;;AttachDbFilename=&quot;C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf&quot;;Integrated Security=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

But........................... the is no "AdventureWorks_Data.mdf" in that folder ?

And the database is installed in the right place !

help !

Where is the AdventureWorks_Data.mdf file located? AttachDbFilename must point to the location of the mdf file. It sounds like you have the wrong connection string. If you're not putting the database into the Data folder, then you need to change your connection string to point to the correct location.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

|||

Did this resolve the issue?

Mike

|||

Hmmm

I've downloaded and installed the Adventure works database

I follow the instructions give here

http://msdn2.microsoft.com/en-us/library/ms310325.aspx

but this command here:

exec sp_attach_db @.dbname=N'AdventureWorks', @.filename1=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf', @.filename2=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_log.ldf'

results in this error:

unable to open physical file,................................................. the system can't find the specified file.

The things is....................... i can't find a "AdventureWorks_Data.mdf" file.

|||

When you downloaded and installed the AdventureWorks sample, you were probably asked for a directory to install to, that's where the database should be. If you don't recall where it went, try searching your hard drive for it. (Start | Search and then look for "AdventrueWorks*")

Once you know where it is, you can either change the path in the command above, or you can move it to the Data directory for the instanse of SQL that you want to attach it to. If search doesn't find the file, that probably means it either didn't get installed, or it was deleted. Try installing again. You may have to uninstall the sample from Add/Remove Programs before you can install it again.

Mike

|||

I basically have the same problem; however, I do have the: AdventureWorks_Data.mdf and AdventureWorks_log.ldf files in the proper directory. But I do a 'search' and do not see the 'AdventureWorks' db file.

I run the script:

exec sp_attach_db @.dbname=N'AdventureWorks', @.filename1=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf', @.filename2=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_log.ldf'

and get:

Msg 1813, Level 16, State 2, Line 1

Could not open new database 'AdventureWorks'. CREATE DATABASE is aborted.

Msg 602, Level 21, State 50, Line 1

Could not find row in sysindexes for database ID 9, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Thanks for any help in advance...

Adventure works database, I can't connect to the database

Database not found !

My web.config file has this bit of code:

<connectionStrings>

<add name="AppConnectionString1" connectionString="Data Source=&quot;.\SQLEXPRESS&quot;;AttachDbFilename=&quot;C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf&quot;;Integrated Security=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

But........................... the is no "AdventureWorks_Data.mdf" in that folder ?

And the database is installed in the right place !

help !

Where is the AdventureWorks_Data.mdf file located? AttachDbFilename must point to the location of the mdf file. It sounds like you have the wrong connection string. If you're not putting the database into the Data folder, then you need to change your connection string to point to the correct location.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

|||

Did this resolve the issue?

Mike

|||

Hmmm

I've downloaded and installed the Adventure works database

I follow the instructions give here

http://msdn2.microsoft.com/en-us/library/ms310325.aspx

but this command here:

exec sp_attach_db @.dbname=N'AdventureWorks', @.filename1=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf', @.filename2=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_log.ldf'

results in this error:

unable to open physical file,................................................. the system can't find the specified file.

The things is....................... i can't find a "AdventureWorks_Data.mdf" file.

|||

When you downloaded and installed the AdventureWorks sample, you were probably asked for a directory to install to, that's where the database should be. If you don't recall where it went, try searching your hard drive for it. (Start | Search and then look for "AdventrueWorks*")

Once you know where it is, you can either change the path in the command above, or you can move it to the Data directory for the instanse of SQL that you want to attach it to. If search doesn't find the file, that probably means it either didn't get installed, or it was deleted. Try installing again. You may have to uninstall the sample from Add/Remove Programs before you can install it again.

Mike

|||

I basically have the same problem; however, I do have the: AdventureWorks_Data.mdf and AdventureWorks_log.ldf files in the proper directory. But I do a 'search' and do not see the 'AdventureWorks' db file.

I run the script:

exec sp_attach_db @.dbname=N'AdventureWorks', @.filename1=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf', @.filename2=N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_log.ldf'

and get:

Msg 1813, Level 16, State 2, Line 1

Could not open new database 'AdventureWorks'. CREATE DATABASE is aborted.

Msg 602, Level 21, State 50, Line 1

Could not find row in sysindexes for database ID 9, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Thanks for any help in advance...

Tuesday, March 6, 2012

AdomdConnection.Cube() Can''t Find Some Cubes In SQL Server2005

I have established some cubes in SQL Server 2005.

But when I use AdomdConnection.Cube() Function to find these cubes, some of these can't be find.

Can someone tell me what reason may be or what I can do ? Thanks!!!

Program: .NET 2005

Server : SQL Server 2005

OS : Windows 2003

P.S. In these Cubes Can't be found, I delete few cubes and establish them again. Then these cubes can be found.

Hi,

The best way is to use a loop to list out all the cubes and check if all of them occur.

Say,

For each oCube in ODatabases.Cubes

Msgbox(oCube.Name)

Next

If all donot occur it might be an issue related to security. Check you have Database wide Privilege.

Thanks

Subhash Subramanyam

|||

Hi~

I use your way and list all the cubes, but some cubes still can not be listed.

And I'm sure I have the database wide privilege.

AdomdConnection.Cube() Can''t Find Some Cubes In SQL Server2005

I have established some cubes in SQL Server 2005.

But when I use AdomdConnection.Cube() Function to find these cubes, some of these can't be find.

Can someone tell me what reason may be or what I can do ? Thanks!!!

Program: .NET 2005

Server : SQL Server 2005

OS : Windows 2003

P.S. In these Cubes Can't be found, I delete few cubes and establish them again. Then these cubes can be found.

Hi,

The best way is to use a loop to list out all the cubes and check if all of them occur.

Say,

For each oCube in ODatabases.Cubes

Msgbox(oCube.Name)

Next

If all donot occur it might be an issue related to security. Check you have Database wide Privilege.

Thanks

Subhash Subramanyam

|||

Hi~

I use your way and list all the cubes, but some cubes still can not be listed.

And I'm sure I have the database wide privilege.

AdomdConnection.Cube() Can''t Find Some Cubes In SQL Server2005

I have established some cubes in SQL Server 2005.

But when I use AdomdConnection.Cube() Function to find these cubes, some of these can't be find.

Can someone tell me what reason may be or what I can do ? Thanks!!!

Program: .NET 2005

Server : SQL Server 2005

OS : Windows 2003

P.S. In these Cubes Can't be found, I delete few cubes and establish them again. Then these cubes can be found.

Hi,

The best way is to use a loop to list out all the cubes and check if all of them occur.

Say,

For each oCube in ODatabases.Cubes

Msgbox(oCube.Name)

Next

If all donot occur it might be an issue related to security. Check you have Database wide Privilege.

Thanks

Subhash Subramanyam

|||

Hi~

I use your way and list all the cubes, but some cubes still can not be listed.

And I'm sure I have the database wide privilege.

ADOMD.net Can't get the KPI.ID or Cube.ID

When you open an AS project, you will see every object has an ID property, just like KPI.ID and cube.ID and Dimention.ID. And that's diffrent of the Name property. You could chanage the name property to everything you like, but when you created an object, you could not change it's ID.

When i use the ADOMD.NET, I could do this:

Dim myKPIConnection As AdomdConnection
Dim myCubeDef As CubeDef
Dim k As Kpi

myConnectionString = "Data Source=" + myOlapServer + ";Catalog=" + myOlapDatabase + ";Provider=MSOLAP;"

myKPIConnection = New AdomdConnection(myConnectionString)
myKPIConnection.Open()

For i = 0 To myKPIConnection.Cubes.Count - 1

If myKPIConnection.Cubes(i).Type = CubeType.Cube Then

myCubeDef = myKPIConnection.Cubes(i)

k = myKPIConnection.Cubes(i).Kpis(0)

MessageBox.Show(k.Name)

MessageBox.Show(k.Caption)

end if
next

But the question is, there's no k.ID or cubes(i).ID property there!

The k.Name and k.Caption both refer to the kpi's Name property in the AS server in factly.

Is that means we could not use the object 's ID property in the ADOMD.NET?

Another question, in MDX, we could only refer a dimention by it's name, and could not by it's ID, right?

ivanchain wrote:

Is that means we could not use the object 's ID property in the ADOMD.NET?

Another question, in MDX, we could only refer a dimention by it's name, and could not by it's ID, right?

That's right. In ADOMD.NET and MDX all references are done by name. The ID property is mainly used by the administrative APIs

Friday, February 24, 2012

ADO.NET connection to SQL fails

Hello,
I'm putting together an ASP.NET web form (using VB.NET) and the DB I'm trying to do an insert to can't validate my login. I've verified that the account does have permissions to access the SQL DB and that everything is granted as far as the INSERT, UPDATE
, etc...
I have my SQL Server (SQL2K) set up for mixed authentication (both SQL and Windows).
I've tried all the suggestions from the "connectionstrings.com" website and I'm still getting errors stating that the login failed.
Here is a copy of the error:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
The above error is happening when I use the connection string of:
"server=MyServer;Initial Catalog=MyDatabase;Integrated Security=TRUE"
I get the same thing when I use "Integrated Security=SSPI" as well.
Here is the error I get when I try to use a user id:
Login failed for user '{user name}'.
The funny thing about it is that the user name specified above is the DBO and it is still rejected.
One last question; have you ever wanted to give up with computers and go back to pen and paper?
Any futher suggestions would be really great! I really appreciate it...
Dale
DBO is not a login, it is a user.
Try connecting with sa (and the sa password). I am guessing that you =
will have better results.
NOTE: You should probably create a login that you will use to connect to =
the database from your web app. If you are planning on using stored =
procedures (a good idea, by the way) they will not need any permissions =
in the database (other than "execute" on the stored procedures used by =
your app).
--=20
Keith
"Dale" <anonymous@.discussions.microsoft.com> wrote in message =
news:1025EFC0-546F-4F76-96CD-75B12AA30E03@.microsoft.com...
> Hello,=20
>=20
> I'm putting together an ASP.NET web form (using VB.NET) and the DB I'm =
trying to do an insert to can't validate my login. I've verified that =
the account does have permissions to access the SQL DB and that =
everything is granted as far as the INSERT, UPDATE, etc...=20
>=20
> I have my SQL Server (SQL2K) set up for mixed authentication (both SQL =
and Windows).=20
>=20
> I've tried all the suggestions from the "connectionstrings.com" =
website and I'm still getting errors stating that the login failed.=20
>=20
> Here is a copy of the error:=20
> Login failed for user '(null)'. Reason: Not associated with a trusted =
SQL Server connection.=20
>=20
> The above error is happening when I use the connection string of:=20
> "server=3DMyServer;Initial Catalog=3DMyDatabase;Integrated =
Security=3DTRUE"=20
>=20
> I get the same thing when I use "Integrated Security=3DSSPI" as well.=20
>=20
> Here is the error I get when I try to use a user id:=20
> Login failed for user '{user name}'.=20
>=20
> The funny thing about it is that the user name specified above is the =
DBO and it is still rejected.=20
>=20
> One last question; have you ever wanted to give up with computers and =
go back to pen and paper? =20
>=20
> Any futher suggestions would be really great! I really appreciate =
it...=20
>=20
> Dale
|||The login failed for user NULL indicates that the account that is
attempting to make the connection is unknown to SQL Server. Look at the IIS
configuration to verify that the user that IIS is using has a login at the
SQL Server. If you are using anonymous access and the IIS machine is on a
separate machine the NT authentication will generate the Login failed for
user NULL.
I would look at articles:
PRB: ASP/ODBC/SQL Server Error 0x80040E4D "Login Failed for User '(Null)'"
http://support.microsoft.com/?id=307002
INF: Authentication Methods for Connections to SQL Server in Active Server
Pages
http://support.microsoft.com/?id=247931
Rand
This posting is provided "as is" with no warranties and confers no rights.
|||The problem you are having may be related to how you've configured
your asp.net application. The app may in fact be attempting to connect
using the aspnet process model account unless you've configured IIS to
use impersonation. There's a pretty good "asp.net security best
practices" whitepaper that bears reading:
http://www.microsoft.com/downloads/r...eleaseID=44047
Your machine.config file has the settings you are using in the
<processModel> section -- the default is to have userName="machine",
which means that the aspnet windows account is being used.
In the meantime, try enabling the aspnet windows login in SQLS and
give it the necessary database access. This should work with the
integrated security=sspi setting in your connection string.
--Mary
On Fri, 16 Apr 2004 10:06:03 -0700, "Dale"
<anonymous@.discussions.microsoft.com> wrote:

>Hello,
>I'm putting together an ASP.NET web form (using VB.NET) and the DB I'm trying to do an insert to can't validate my login. I've verified that the account does have permissions to access the SQL DB and that everything is granted as far as the INSERT, UPDAT
E, etc...
>I have my SQL Server (SQL2K) set up for mixed authentication (both SQL and Windows).
>I've tried all the suggestions from the "connectionstrings.com" website and I'm still getting errors stating that the login failed.
>Here is a copy of the error:
>Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
>The above error is happening when I use the connection string of:
>"server=MyServer;Initial Catalog=MyDatabase;Integrated Security=TRUE"
>I get the same thing when I use "Integrated Security=SSPI" as well.
>Here is the error I get when I try to use a user id:
>Login failed for user '{user name}'.
>The funny thing about it is that the user name specified above is the DBO and it is still rejected.
>One last question; have you ever wanted to give up with computers and go back to pen and paper?
>Any futher suggestions would be really great! I really appreciate it...
>Dale

ADO.NET - Many-To-Many Relationships

How do you show many to many relationships in ASP.NET with datasources?

I can retrieve the information from the database easily but I can't manage to save that information into a variable so that i can then call for only information in the M2M table related to the ID Key I want. For example..

1<asp:Label ID="lblTestLabel" Text='<%# DataBinder.Eval(Container.DataItem, "title_id")%>' Runat="server" />23<script language="VB" runat="server">4sub Page_Load(sender as Object, e as EventArgs)5Dim lblTitleID As Label = Repeater1.FindControl("lblTestLabel")6Response.Write(lblTitleID.text)7End Sub8</script>

When I try to run this script it dosn't work and I get the error:

System.NullReferenceException: Object reference not set to an instance of an object.

For line 6 of the code above. Is there a way to just retrieve information from a datasource without storing information into a label first?

PS: I use sqldatasource tags to retrieve information like:

1<asp:SqlDataSource ID="DataSet1" runat="server"2ConnectionString="Driver={MySQL ODBC 3.51 Driver};server=localhost;database=;user=;pwd=;option=3;"3ProviderName="System.Data.Odbc"4SelectCommand="Select * from titles order by title_id">5</asp:SqlDataSource>

You should listen to the ItemDataBound event. That way, you will be able to do any modifications on an item before it is rendered.

See MSDN for reference and an example: http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.itemdatabound.aspx

|||

I managed to look at the sample code and break it down enough to where I can understand it all. I didn't know about testing the itemtypes before changing the label text. It helped out a lot. I still have some stuff to fix up, but I'm sure I can figure out the rest from here.

Thanks for the help.

Sunday, February 19, 2012

ADO Recordset.find method Criteria

Can you use an adodb.recordset.find method to locate a record on an MS SQL 2000 server table? I can't figure out how to specify the criteria correctly and haven't found any good documentation. Ex:
Dim tblBusiness As New ADODB.Recordset
'Make an ADO connection to the database.
cn.ConnectionString = "XXXXXXXXXXXXXX'"
cn.Open
cn.Properties("Current Catalog") = "MyDB"
cmd.ActiveConnection = cn
cmd.CommandType = adCmdText
tblBusiness.Open "tblBusiness", cn, adOpenDynamic, adLockReadOnly
tblBusiness.Find (Criteria, SkipRecords, SearchDirection, Start)
I haven't found anything detailing how to specify the criteria for the find.
Thanks.
My recommendation would be not to use Find, but to use a select
statement with a WHERE clause, selecting only required data. What you
are trying to do is fetch an entire table, then throw away the rows
you don't want. Think for a moment about what happens to the network,
the server, and your client application when the table has 1,000,000
rows. "SELECT <column list> FROM <TableName> WHERE <some
field>=Criteria" is far more efficient than filtering after the fact.
--Mary
On Sat, 8 May 2004 16:31:01 -0700, "DB"
<anonymous@.discussions.microsoft.com> wrote:

>Can you use an adodb.recordset.find method to locate a record on an MS SQL 2000 server table? I can't figure out how to specify the criteria correctly and haven't found any good documentation. Ex:
> Dim tblBusiness As New ADODB.Recordset
>'Make an ADO connection to the database.
> cn.ConnectionString = "XXXXXXXXXXXXXX'"
> cn.Open
> cn.Properties("Current Catalog") = "MyDB"
> cmd.ActiveConnection = cn
> cmd.CommandType = adCmdText
> tblBusiness.Open "tblBusiness", cn, adOpenDynamic, adLockReadOnly
> tblBusiness.Find (Criteria, SkipRecords, SearchDirection, Start)
>I haven't found anything detailing how to specify the criteria for the find.
>Thanks.

Monday, February 13, 2012

ado 2.8 and sqlxml.... retrieve from field?

hello,
i have a server side xml implementation that works great but i can't get the
data to my client.
i have a stored proc that returns 2 recordsets... both are "selecct...
form... for xml". the data in the field is exactly as i want it (when i run
it in sql query analyzer).
problem #1: i can retrieve the text from a command object if i execute it
into an ado stream.... but i can't get both recordsets. weird, right? cause
you can get multiple recordsets from a command object... but nope. your
command object has to write to a stream, not a recordset.
problem #2: ok, so i use a recordset. great, right? i can execute it, get my
data, move to the next recordset, get my data... but nope. i cannot figure
out a way to get the data out of the field. it's in binary form.
i need to retrieve both text strings... but how?
anyone help? please?
dushan bilbija
Hello Dushan,
Its been years since I've worked with this and for a good reason. Using SqlXml
with classic ADO is a PITA compared to .NET. If I were you, I'd write a .NET
component that uses the ExecuteXmlReader (or even ExecuteScalar) to get the
strings and pass those back. You should be able to call that assembly (the
output of .NET compliation, given the extension DLL) from your application
as needed.
Its a hack, but it should work
Thank you,
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/
|||not a bad idea... but i managed to find the solution. if you carry out a
sequence of select statements, each with for xml, the command object
retrieves them all and concatenated. so it works out well.
dushan
"Kent Tegels" <ktegels@.develop.com> wrote in message
news:b87ad742a79c8c7e4e55f74cd40@.news.microsoft.co m...
> Hello Dushan,
> Its been years since I've worked with this and for a good reason. Using
> SqlXml with classic ADO is a PITA compared to .NET. If I were you, I'd
> write a .NET component that uses the ExecuteXmlReader (or even
> ExecuteScalar) to get the strings and pass those back. You should be able
> to call that assembly (the output of .NET compliation, given the extension
> DLL) from your application as needed.
> Its a hack, but it should work
> Thank you,
> Kent Tegels
> DevelopMentor
> http://staff.develop.com/ktegels/
>