| | |
Creating Database, User Name and User ID
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2008
Posts: 55
Reputation:
Solved Threads: 1
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.
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.
The database connection string should be like this
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.
VB.NET Syntax (Toggle Plain Text)
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.
![]() |
Similar Threads
- Beginners Guide To Creating Database Driven Website (Site Layout and Usability)
- Creating a new array dynamically for checkboxes? (PHP)
- creating database in runtime (Visual Basic 4 / 5 / 6)
- Creating different username's for the same login (PHP)
- Help with Accessing MS Access Database using Java (Java)
- I am New In MySQL. Problem With MySQL Database Plz Help. (MySQL)
- database questions I have (Database Design)
- Creating a Basic String Database (C++)
- HOWTO: Run a Query on a Database using ODBC and return all Results into a DGV Object (C#)
Other Threads in the VB.NET Forum
- Previous Thread: Project
- Next Thread: making a banking project
Views: 1223 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 30minutes 2005 2008 access application arithmetic array basic binary bing button buttons c# center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dll dropdownlist error excel file-dialog folder ftp google hardcopy highlighting image images inline listview login math mobile ms navigate net networking opacity output peertopeervideostreaming picturebox picturebox1 plugin port print printing problem problemwithinstallation project reports" save savedialog searchbox serial server soap sorting sql string syntax tcp text textbox timer toolbox trim updown upload usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf





