如何使用Phpmyadmin将我的Vb.Net软件连接到我的Sql [英] How Do I Connect My Vb.Net Software To My Sql Using Phpmyadmin

查看:44
本文介绍了如何使用Phpmyadmin将我的Vb.Net软件连接到我的Sql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的域服务器上创建了一个SQL数据库并安装了phpMyAdmin来登录sql数据库但是当我尝试连接时我在打开的代码上出错,我把我的代码放在下面





I have created an SQL database on my domain server and installed phpMyAdmin to log into the sql database but when i try to connect i get an error on the open code, i have put my code below


Imports MySql.Data.MySqlClient
Imports System.Data
Imports System.Data.SqlClient

Public Class frmLogincreator

Private Sub btncreate_Click(sender As Object, e As EventArgs) Handles btncreate.Click
       Dim cn As New MySqlConnection
       Dim Command As New MySqlCommand
       Dim reader As MySqlDataReader

       cn.ConnectionString = "server= ****************.**.**/phpMyAdmin; user id= *************; password =*****************; database = stockin1_password"
       Command.Connection = cn
       cn.Open()
       Command.CommandText = " SELECT username,password FROM Login WHERE username= '" & txtusername.Text & "' AND Password = '" & txtpassword.Text & "'"

       reader = Command.ExecuteReader
       If reader.HasRows Then
           MsgBox("Username or Password already exist Please enter a Diferent Username or Password!", MsgBoxStyle.Critical, "Checkpoint")
       Else
           Command.Dispose()
           reader.Dispose()
           Command.CommandText = "Insert into Login (Username, Password, ClientName, ClientSurname) values('" & txtusername.Text & "','" & txtpassword.Text & "','" & txtname.Text & "','" & txtsurname.Text & "')"
           Command.ExecuteNonQuery()
           MsgBox("Information Successfully saved!/ Account Generation Succeed!", MsgBoxStyle.Information, "Information Generation")
           txtusername.Clear()
           txtpassword.Clear()
       End If

   End Sub

推荐答案

我从未与vb.net合作过。但这里有一些你需要了解的事情。



1.您向全世界提供了数据库的访问链接,可以通过phpmyadmin和您的密码进行访问。(我猜测它是愚蠢的还是它的测试/学习网站)

2.当你说服务器stockinvestments.co.za是你的服务器而不是stockinvestments.co.za/phpMyAdmin。

3. stockinvestments.co.za/是一个http服务器,/ phpMyAdmin是uri。甚至不清楚你的mysql是否允许你从其他localhost访问。

3. phpMyAdmin是一个基于php的应用程序,可以在mysql服务器上进行简单的操作,但它不是任何类型的服务或服务器。

4. cn是一个MySqlConnection连接而不是http连接。



如果您的mysql服务器配置正确,那么您可以从外部访问服务器。但它不是我已经检查过:)因为你的用户名和密码也存在...............如果它是正确的那么你的连接字符串将是



I never did any work with vb.net. But here is few things you need to understand.

1. You gave the world the access link for your database which can be accessed through phpmyadmin along with your password.(which i guess either stupid or its a test/learning site)
2. when you say server "stockinvestments.co.za" is your server not "stockinvestments.co.za/phpMyAdmin".
3. stockinvestments.co.za/ is an http server and /phpMyAdmin is uri. it is not even clear whether your mysql allows you to access from other then localhost.
3. phpMyAdmin is a php based application to do simple operation on mysql server but it is not any kind of service or server.
4. cn is a MySqlConnection connection not httpconnection.

if your mysql server is properly configured then you can access the server from outside world. But it is not I already have checked :) cause your username and password is also there............... if it is proper then your connection string would be

cn.ConnectionString = "server=server-name; user id= *************; password =*****************; database = stockin1_password"





并且使用你的mysql客户端,我只使用mysql命令行客户端,你可以使用这些信息从地球上任何地方连接。



and using your mysql client, I use only mysql commandline client, you can connection from anywhere on earth using those info.


这篇关于如何使用Phpmyadmin将我的Vb.Net软件连接到我的Sql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆