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 8782731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:38:42+00:00 2026-06-13T20:38:42+00:00

I’m working on a VB.NET Program that inputs data to a SQL Server CE

  • 0

I’m working on a VB.NET Program that inputs data to a SQL Server CE local database (*.sdf file).

My code is this:

    Imports System.Data.SqlClient
    Public Class Form1
    Dim myConnection As SqlConnection
    Dim myCommand As SqlCommand
    Dim ra As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        myConnection = New SqlConnection("Data Source= Database1.sdf")
        myConnection.Open()
        myCommand = New SqlCommand("Insert into website('"TextBox1.Text"')", myConnection)
        ra = myCommand.ExecuteNonQuery()
        MessageBox.Show("Updated")
        myConnection.Close()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = My.Settings.SaveWebsite
    End Sub
End Class

I get three errors during compile:

Error 1:
Argument not specified for parameter ‘connection’ of ‘Public Sub New(cmdText As String, connection As
System.Data.SqlClient.SqlConnection, transaction As
System.Data.SqlClient.SqlTransaction)’.

Error 2
Comma, ‘)’, or a valid expression continuation expected.

Error 3
Value of type ‘System.Data.SqlClient.SqlConnection’ cannot be converted to ‘System.Data.SqlClient.SqlTransaction’.

This is first time I am using VB.NET and I’m hoping someone might know what I’m doing wrong here.

Thanks in advance

  • 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-13T20:38:43+00:00Added an answer on June 13, 2026 at 8:38 pm

    Well, for starters: when targeting SQL Server Compact Edition (the *.sdf file), you need to use SqlCeConnection and SqlCeCommand (not SqlConnection or SqlCommand – those are for the full-blown SQL Server, non-compact)

    Secondly: your INSERT statement is incorrect – the correct SQL syntax would be:

    INSERT INTO Table (col1, col2, ..., colN) 
    VALUES(val1, val2, ..., valN)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I know there's a lot of other questions out there that deal with this
I have a reasonable size flat file database of text documents mostly saved in
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.