1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

data connectivity

Discussion in 'ASP.NET' started by rafeek610, Oct 6, 2010.

  1. rafeek610

    rafeek610 New Member

    Joined:
    Sep 24, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    how to connect my sql with the vb.net data connectivity????????????
     
  2. dotNet Zombie

    dotNet Zombie New Member

    Joined:
    Aug 28, 2010
    Messages:
    34
    Likes Received:
    10
    Trophy Points:
    0
    Occupation:
    .Net Developers
    Location:
    Minnesota
    Home Page:
    You can use the DataSource Control

    or you can code it using the SqlDataAdapter objects
     
    shabbir likes this.
  3. Ami Desai

    Ami Desai New Member

    Joined:
    Jan 5, 2017
    Messages:
    30
    Likes Received:
    13
    Trophy Points:
    3
    Location:
    Ahmedabad
    Home Page:
    Hi,

    You can check this

    Add the following code before Public Class Form1
    Code:
    Imports MySql.Data.MySqlClient
    Then add the following declaration below Public Class Form1
    Code:
    Dim conn As New MySqlConnection
    Then add the following
    Code:
    Public Sub connect()
    Dim DatabaseName As String = "Database NAme"
    Dim server As String = "ip address here"
    Dim userName As String = "sarmasar here"
    Dim password As String = "password here"
    If Not conn Is Nothing Then conn.Close()
    conn.ConnectionString = String.Format("server={0}; user id={1}; password={2}; database={3}; pooling=false", server, userName, password, DatabaseName)
    Try
    conn.Open()
    MsgBox("Connected")
    Catch ex As Exception
    MsgBox(ex.Message)
    End Try
    conn.Close()
    End Sub
    Call the connect sub when the form first loads:
    Code:
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    connect()
    End Sub

    Thanks
     
    shabbir likes this.
  4. Vishal19

    Vishal19 New Member

    Joined:
    Feb 17, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Hi

    Welcome to this forums sites. Here you can find a lot of information about your question. But I have doesn’t have much information about it. For more information please visit here.

    TOP 5 INTERACTIVE SOCIAL MEDIA MARKETING TOOLS
     

Share This Page