Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.31/5 (4 votes)
See more:
Imports System.Data.SqlClient

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


        Dim coon As New SqlConnection = "data source = DESKTOP-S0KOBIU ; initial catalog= frist; Integrated Security=True"
        Dim da As New SqlDataAdapter
        Dim dt As New DataTable
        da = New SqlDataAdapter("select * from info", coon)
        da.Fill(dt)
        DataGridView1.DataSource = dt
    End Sub
End Class


What I have tried:

<pre>Imports System.Data.SqlClient

Public Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


        Dim coon As New SqlConnection = ("data source = DESKTOP-S0KOBIU ; initial catalog= frist; Integrated Security=True")
        Dim da As New SqlDataAdapter
        Dim dt As New DataTable
        da = New SqlDataAdapter("select * from info", coon)
        da.Fill(dt)
        DataGridView1.DataSource = dt
    End Sub
End Class
Posted
Updated 19-Oct-21 8:54am
Comments
Richard MacCutchan 19-Oct-21 14:07pm    
But what is the question?
Member 15329613 19-Oct-21 14:28pm    
1. Use an appropriate title. It will help get your question answered faster.
2. What is the problem?
OriginalGriff 19-Oct-21 14:45pm    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
Use the "Improve question" widget to edit your question and provide better information.

1 solution

If you are trying to use SQL Server: this is not the simplest database to get started with, it is also difficult to distribute with your application.
When your needs are simple, take a look at: LiteDB[^]
 
Share this answer
 
Comments
Richard Deeming 20-Oct-21 11:42am    
I thought "answers" of the form "You're using <X>; why don't you use <Y> instead?" were the exclusive domain of StackOverflow.

The OP hasn't managed to ask a question, and yet you still think it's appropriate to tell them to dump their DBMS and replace it with something else instead?
RickZeeland 20-Oct-21 12:31pm    
Yes, most beginners think that SQL Server is the only route to take, but there are more and better options IMHO. It is good to point that out to them. I used SQL Server for years and was hard to convince too to use another database, but after working with PostgreSQL I never want to go back to SQL Server anymore.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900