Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8482923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:56:40+00:00 2026-06-10T19:56:40+00:00

This is my code for connection: Imports System.Data.SqlClient Public Class frm_edit_patient Dim con As

  • 0

This is my code for connection:

Imports System.Data.SqlClient
Public Class frm_edit_patient
    Dim con As New SqlConnection
    Private Sub frm_edit_patient_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        frm_dashboard.Enabled = True
        Me.Hide()
    End Sub
    Private Sub frm_edit_patient_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Database1DataSet1.patients' table. You can move, or remove it, as needed.
        Me.PatientsTableAdapter.Fill(Me.Database1DataSet1.patients)
        frm_dashboard.Enabled = False
        Try
            Dim myConString As String = My.Settings.Database1ConnectionString
            con.ConnectionString = myConString
            con.Open()
            con.Close()
            MessageBox.Show("connected")
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        frm_dashboard.Enabled = True
        Me.Hide()
    End Sub
End Class

but this is giving me error:

enter image description here

I am using binding source for database connection….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:56:42+00:00Added an answer on June 10, 2026 at 7:56 pm

    Database.sdf is a Sql Compact database file, not a Sql Server catalog name.

    You need to use SqlCeConnection not a SqlConnection

    Thus you need to declare

    Dim con As New SqlCeConnection
    

    also remember that you need a reference to the assembly System.Data.SqlServerCe
    (in System.Data.SqlServerCe.dll)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imports System.Data.SqlClient Public Class Form3 Private cs As New SqlConnection(Data Source=HUSAIN-PC;Initial Catalog=final1;Integrated Security=True) Private
Imports System.Data.OleDb Public Class Log Private mConnectionString As String = Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx)(PORT=1521)))(CONNECT_DATA=(SID=xxx)(SERVER=DEDICATED)));User Id=xxx;Password=xxx; Dim
Okay, so i have this code i wrote: class Connection { public static StreamWriter
Imports System.Data.SqlClient Module Module1 Sub Main() Dim iCount As Integer = 1 Try Do
Im using this code for mysql connection $con = mysql_connect(localhost:/var/lib/mysql/mysql.sock, abc , xyz); if
I'm using this kind of code for my TCP/IP connection: sock = new Socket(host,
This code runs on my local RoR/Windows 7 (64-bit): sql = ActiveRecord::Base.connection() last_pk =
I'm using this code to read the connection string from my app.config file but
C# 2008 I am using this code to test for an internet connection. As
I am trying to run this code: ItemTaxonomy iTaxonomy = from itemTaxonomy in connection.ItemTaxonomy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.