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:
    http://www.dotnetzombie.net
    You can use the DataSource Control

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

    Ami Desai Member

    Joined:
    Jan 5, 2017
    Messages:
    42
    Likes Received:
    17
    Trophy Points:
    8
    Location:
    Ahmedabad
    Home Page:
    http://www.ifourtechnolab.com/
    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:
    4
    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
     
  5. Mridula0310

    Mridula0310 New Member

    Joined:
    Jan 31, 2018
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Female
    Use datasource comtrol to connect sql with .net
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice