| | |
Creating Database, User Name and User ID
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2008
Posts: 54
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 |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem project read remove save searchbox searchvb.net select serial shutdown soap sorting survey table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio2008 web webbrowser winforms wpf year





