Hi
I am new in VB.net . I dont know how to connect vb.net with sqlserver. Would any one help me regarding this .
Thanks
Nazrul

Recommended Answers

All 4 Replies

first you have make a module to connected vb.net with sqlserver.

you can add this code in module :

Imports System.Data
Imports System.Data.SqlClient

Module ModuleName
Public conn As SqlConnection

Public Function GetConnect()

conn = New SqlConnection("server = ServerName;database = DatabaseName;Trusted_Connection = yes")

Return conn
End Function
End Module

you can changes ModuleName,ServerName n DatabaseName with your own.

after you built a module you can call that modul in your form code.
ex :
Dim conn As SqlConnection
conn = GetConnect ()
you will use Conn to open connection (conn.open) and close connection (conn.Close).

Thanking You for ur help.

I have made project with vb access. How i will make report of vb. Plz help me .

Thanks Nazrul

hi,
you mean that u want to make report using access as your database or you make report direct from access and use vb sintax.

actually you must using crystal report to make reporting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.