Imports System.Data.SqlClient
Private Sub SqlClientPermission(value As Boolean)
allowBlankPassword = True
End Sub
Function CreateCommand() As SqlCommand
Dim sqlconnectionCommand As New SqlConnection("
Data Source=MSSQLSERVER;
server=(localdb)\Projects;
User Id=xxxx_user-PC\xxxx_user;
Password=;
Database=ColorTable_database.sdf;
Integrated Security=false;
")
sqlconnectionCommand.Open()
sqlconnectionCommand.RetrieveStatistics()
Dim sqlqueryString As String = "SELECT ColorTable.* FROM ColorTable"
Dim sqlqueryCommand As New SqlCommand(sqlqueryString, sqlconnectionCommand)
'Printing Out the SQL Result
Return ViewData("sqlqueryCommand")
End Function
The Question:
Does anyone have suggestions to accomplish a database connection by the code above?
I am getting the error message:
Login failed for user 'xxxx_user-PC\xxxx_user'.
By the current version of .NET 4.5 and Microsoft SQL Server Express I do not have an
executeable program in the programs menu for the Microsoft SQL Server, since I often have gotten recommended to check the
access permissions in the security settings.
Also, are there any alternatives I could try to accomplish an established database connection?
The Tools Used:Visual Studio 2012, VB .NET 4.5 MVC 4, Microsoft SQL Server Express
Sorry, but did we not answer your question earlier today or am I dreaming things? I know that coffee at this hour is usually not such a good idea ;-) but I think I remember replying to a similar post today...anyway...I noticed that you do not provide a value
for the password in the connectionString. Are you hiding it from us or have you forgotton to add a value in your solution?
zevian
0 Points
38 Posts
Establishing a Database Connection - VB .NET 4.5 MVC 4 Visual Studio 2012
Nov 21, 2012 08:17 PM|LINK
The Controller:
Imports System.Data.SqlClient Private Sub SqlClientPermission(value As Boolean) allowBlankPassword = True End Sub Function CreateCommand() As SqlCommand Dim sqlconnectionCommand As New SqlConnection(" Data Source=MSSQLSERVER; server=(localdb)\Projects; User Id=xxxx_user-PC\xxxx_user; Password=; Database=ColorTable_database.sdf; Integrated Security=false; ") sqlconnectionCommand.Open() sqlconnectionCommand.RetrieveStatistics() Dim sqlqueryString As String = "SELECT ColorTable.* FROM ColorTable" Dim sqlqueryCommand As New SqlCommand(sqlqueryString, sqlconnectionCommand) 'Printing Out the SQL Result Return ViewData("sqlqueryCommand") End FunctionThe Question:
Does anyone have suggestions to accomplish a database connection by the code above?
I am getting the error message:
By the current version of .NET 4.5 and Microsoft SQL Server Express I do not have an executeable program in the programs menu for the Microsoft SQL Server, since I often have gotten recommended to check the access permissions in the security settings.
Also, are there any alternatives I could try to accomplish an established database connection?
The Tools Used: Visual Studio 2012, VB .NET 4.5 MVC 4, Microsoft SQL Server Express
bweber89
Member
486 Points
119 Posts
Re: Establishing a Database Connection - VB .NET 4.5 MVC 4 Visual Studio 2012
Nov 21, 2012 08:52 PM|LINK
Hi zevian
Sorry, but did we not answer your question earlier today or am I dreaming things? I know that coffee at this hour is usually not such a good idea ;-) but I think I remember replying to a similar post today...anyway...I noticed that you do not provide a value for the password in the connectionString. Are you hiding it from us or have you forgotton to add a value in your solution?
Hope it helps
Cheers
Junior Software Developer
zevian
0 Points
38 Posts
Re: Establishing a Database Connection - VB .NET 4.5 MVC 4 Visual Studio 2012
Nov 21, 2012 08:54 PM|LINK
I am actually not using a password - thus the "allowBlankPassword".