0

Hi
I m new to Vb.net. i need to Know anout the ConnectionString Details,.
For eg.

First Name
Last Name
PH Number

Use this 3 datas to save Sql.
plz give me the Coding for this ...

2
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by prasannapower
0

Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
Dim constr As String
Dim Sql As String
Dim red As String
Sql = "Select * from Sample"
Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=QB;uid=sa;Pwd=pisces;persist security info=False;initial catalog=Sample")
MsgBox("Test")
Try
con.Open()
MsgBox("Connection opened successfully.")
constr = "Insert Sample where Name='" & txtname.Text & "' and Number='" & txtnumber.Text & "'"
Dim com As New System.Data.SqlClient.SqlCommand(constr, con)
Finally
con.Close()
End Try
End Sub

0

put this code on module (my module named koneksi)

'In Module
'Declare outside of class
Imports System.Data
Imports System.Data.SqlClient

Module Koneksi
    Public conn As SqlConnection
    Public Function GetConnect()
        conn = New SqlConnection("server = MyServerName;database = MyDatabaseName;Trusted_Connection = yes")
        Return conn
    End Function
End Module
0

Thank you....

But .,

I m using LAN Connection,My system used as remot , i tryed this aslo showing error ,
sometime system become HANG

What shoud do ???

Some times my system Hang !!!!

0

I m using LAN Connection,My system used as remot ,
sometime system become HANG

What shoud do ???

Some times my system Hang !!!!

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.