943,920 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1850
  • VB.NET RSS
Oct 18th, 2008
0

Creating Database, User Name and User ID

Expand Post »
Hi friends,
Please tell me how can i create database and user id through below code
i am gotting problem of user login failed. I don't know how can i create database,user through vb.net


Dim conn As New SqlConnection("Server=localhost;user id=;database =;")
Dim comm As New SqlCommand
comm.Connection = conn
comm.CommandType = CommandType.Text
Dim sql As String
sql = "CREATE DATABASE testDB"
comm.CommandText = sql
conn.Open()
comm.ExecuteNonQuery()
conn.Close()


Please help.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
pardeep3dec is offline Offline
87 posts
since Jul 2008
Oct 18th, 2008
0

Re: Creating Database, User Name and User ID

The database connection string should be like this

VB.NET Syntax (Toggle Plain Text)
  1. Dim conn As New SqlConnection("Data Source=SERVER_NAME;Initial Catalog=DATABASE;uid=USERNAME;pwd=PASSWORD;")


If in your code you will be creating a database in SQL then you will have to connect to another database (in the connection string) first.
Reputation Points: 16
Solved Threads: 19
Junior Poster
ptaylor965 is offline Offline
169 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Project
Next Thread in VB.NET Forum Timeline: making a banking project





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC