Click here to Skip to main content
15,907,687 members
Home / Discussions / Database
   

Database

 
Questionsql statement to find missing records Pin
johnnysmith117-Feb-10 16:25
johnnysmith117-Feb-10 16:25 
AnswerRe: sql statement to find missing records Pin
_Damian S_17-Feb-10 17:29
professional_Damian S_17-Feb-10 17:29 
GeneralRe: sql statement to find missing records Pin
johnnysmith117-Feb-10 21:11
johnnysmith117-Feb-10 21:11 
GeneralGrouping Related Stored Procedures Pin
AspDotNetDev17-Feb-10 12:55
protectorAspDotNetDev17-Feb-10 12:55 
GeneralRe: Grouping Related Stored Procedures Pin
Not Active17-Feb-10 14:22
mentorNot Active17-Feb-10 14:22 
GeneralRe: Grouping Related Stored Procedures Pin
AspDotNetDev17-Feb-10 16:22
protectorAspDotNetDev17-Feb-10 16:22 
GeneralRe: Grouping Related Stored Procedures Pin
Mycroft Holmes17-Feb-10 17:08
professionalMycroft Holmes17-Feb-10 17:08 
Questionopen database Pin
mhh11217-Feb-10 11:26
mhh11217-Feb-10 11:26 
Once more we can't connect to the database. We get the age old message:

Exception Details: System.Data.SqlClient.SqlException: Cannot open user default database. Login failed.
Login failed for user 'HKRAM\Mark Hardenbergh'. HKRAM is the name of my computer. Mark Hardenbergh is, obviously, me.

Which means to me there is something wrong with my user name. Anybody know what's wrong with my user name? Do I have another name? Where do I find my other name. I understand that I could use sa for my name, but that doesn't work either.

Here is the code written on the default2.aspx.vb page, the code behind page.

Imports System.Data.SqlClient

Partial Class Default2
Inherits System.Web.UI.Page


Protected Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim cn As New SqlConnection("C:\DOCUMENTS AND SETTINGS\MARK HARDENBERGH\MY DOCUMENTS\VISUAL STUDIO 2008\WEBSITES\WEBSITE5\APP_DATA\VANILLA.MDF;user id=HKRAM\Mark Hardenbergh")

Dim cmd As New SqlCommand
With cmd
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "mhhtrial"
.Connection = cn
.Connection.Open()
.ExecuteNonQuery()
.Connection.Close()
.Dispose()
End With
End Sub


No doubt everyone can recognize what I am trying to do. I am trying to perform the simple taks of running a stored procedure. It is in a database called vanilla.mdb. And, yes, it exist there. However I can't get to square 1 because the fool thing won't let me connect to vanilla.mdb.

As you can imagine, I have a gridview that finds a table in vanilla.mdb and displays it beautifully. When I do gridviews and have the connection string turning up in web.config, there is no problem.

The connection string that is in the web.config file is:
<add name="VanillaConnectionString" connectionString="Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\Vanilla.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />

It certainly would be nice, since this connection string obviously works, if I could use it in the vb in the code behind page. But, so far, no forum wants to explain that, much less any book I have bought.

Can anyone straighten out this Dim cn as New SqlConnection....... out so I can move along?
AnswerRe: open database Pin
Not Active17-Feb-10 11:53
mentorNot Active17-Feb-10 11:53 
GeneralRe: open database Pin
mhh1125-Mar-10 9:38
mhh1125-Mar-10 9:38 
GeneralRe: open database Pin
Not Active5-Mar-10 9:55
mentorNot Active5-Mar-10 9:55 
AnswerRe: open database Pin
Ashfield17-Feb-10 21:48
Ashfield17-Feb-10 21:48 
QuestionDate format in ACCESS database Pin
Johnkokk16-Feb-10 23:55
Johnkokk16-Feb-10 23:55 
AnswerRe: Date format in ACCESS database Pin
Eddy Vluggen17-Feb-10 0:13
professionalEddy Vluggen17-Feb-10 0:13 
GeneralRe: Date format in ACCESS database Pin
Luc Pattyn17-Feb-10 0:32
sitebuilderLuc Pattyn17-Feb-10 0:32 
GeneralRe: Date format in ACCESS database Pin
Eddy Vluggen17-Feb-10 0:52
professionalEddy Vluggen17-Feb-10 0:52 
GeneralRe: Date format in ACCESS database Pin
Luc Pattyn17-Feb-10 1:00
sitebuilderLuc Pattyn17-Feb-10 1:00 
GeneralRe: Date format in ACCESS database Pin
Johnkokk17-Feb-10 0:33
Johnkokk17-Feb-10 0:33 
AnswerRe: Date format in ACCESS database Pin
thatraja17-Feb-10 0:15
professionalthatraja17-Feb-10 0:15 
GeneralRe: Date format in ACCESS database Pin
Johnkokk17-Feb-10 0:40
Johnkokk17-Feb-10 0:40 
AnswerRe: Date format in ACCESS database Pin
Luc Pattyn17-Feb-10 0:37
sitebuilderLuc Pattyn17-Feb-10 0:37 
QuestionCreate constraints for lastname, firstname and middlename Pin
Yosh_16-Feb-10 22:06
professionalYosh_16-Feb-10 22:06 
AnswerRe: Create constraints for lastname, firstname and middlename Pin
Eddy Vluggen17-Feb-10 0:17
professionalEddy Vluggen17-Feb-10 0:17 
QuestionDatabase Login Pin
cdpace16-Feb-10 20:16
cdpace16-Feb-10 20:16 
QuestionHow to write Pin
abglorie16-Feb-10 19:57
abglorie16-Feb-10 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.