| | |
Creating Database, User Name and User ID
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2008
Posts: 52
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
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array basic beginner bing browser button buttons center check code combobox crystalreport cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel fade file-dialog filter forms ftp generatetags hardcopy html images input insert intel internet mobile monitor ms net networking objects open output panel passingparameters pdf picturebox picturebox1 port position printing problem project save searchvb.net select serial settings shutdown soap sqlserver survey tcp temperature text textbox timer timespan toolbox transparency trim update updown user vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet view visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode year





