Results 1 to 2 of 2

Thread: I need to call to make run Mudule1 and the statement in button click is not working?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary
    Posts
    273

    I need to call to make run Mudule1 and the statement in button click is not working?

    I am using VB 2017 and SQLEpress. I think something is wrong with the code from the button click. Please, I need help with this matter. Thank you in advance.

    Code:
    Imports System.Data.SqlClient
    
    Public Class Form1
    
        Private Sub BtnCreateTb_Click(sender As Object, e As EventArgs) Handles BtnCreateTb.Click
    
            Call Main()
    
        End Sub
    
    End Class
    
    Module Module1
        Sub Main()
            ' Define your connection string (update this based on your server and database)
            Dim connectionString As String = ("Server=localhost\SQLEXPRESS;Database=master;Trusted_Connection=True;")
            ' Define the SQL command to create a new table
            Dim createTableQuery As String = "
            CREATE TABLE Employees (
    Last edited by Shaggy Hiker; Dec 14th, 2024 at 03:47 PM. Reason: Added CODE tags.
    mannyso

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width