如何将可视化基本变量插入网站的数据库?

时间:2013-05-30 23:13:52

标签: mysql vb.net

我有这个VB代码:

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim phpref As String = ""

        For Each foundFile As String In My.Computer.FileSystem.GetFiles("c:\windows\system32\drivers")
            Dim sFileName As String = (foundFile)
            Dim Info As FileVersionInfo
            Info = FileVersionInfo.GetVersionInfo(sFileName)

            phpref &= Info.FileDescription & "-"
            phpref &= Info.FileVersion & "|"
        Next

        Dim userip As String = GetIPAddress()
    End Sub

    Private Function GetIPAddress() As String

        Dim strHostName As String
        Dim strIPAddress As String

        strHostName = System.Net.Dns.GetHostName()
        strIPAddress = System.Net.Dns.GetHostByName(strHostName).AddressList(0).ToString()

       Return strIPAddress
    End Function
End Class

我想将变量userip和变量phpref插入到我网站的mysql数据库中。

1 个答案:

答案 0 :(得分:0)

这个问题太广泛了,无法回答,但这里有一些参考链接可以帮助您入门:

mySQL的连接字符串

http://www.connectionstrings.com/providers/mysql-connector-net-mysqlconnection

有关如何使用ADO.NET使用VB.NET连接mySQL的视频

http://www.youtube.com/watch?v=u3hRvoUpetQ

试试这些,然后如果你遇到困难,请在这里提出一个更具体的问题