I installed visual studio 2010 and am working with visual basic
when installing the sql server it asked if i would like to use windows authentication or sql authentication
i selected windows authentication
i am trying to connect using adodb connection
and am having challenge with it.
i got this code online but its not working for me cause am not sure the username and password to use
Module General
Public conn As New ADODB.Connection
Public sql As String
Public rs, rss As New ADODB.Recordset
Public admission_no As Integer
Public view_student As Boolean = False
Public visitor_name, vdate, sname, comp, dat, stat
Public visitor As Boolean = False
Public complaint As Boolean = False
Public abc As String
Public Function OpenDB()
Try
If Conn.State = 1 Then Conn.Close()
conn.Open("Provider=SQLOLEDB.1;Persist Security Info=False;user id=sa;password=q1w2e3r4/;Initial Catalog=hostel1;Data Source=SHARUN-PC")
Return (0)
Catch ex As Exception
MsgBox("Database is not connected ..... Please Check Your Network Connection", MsgBoxStyle.Critical)
End
End Try
End Function
End Module
i modified it as
Module General
Public conn As New ADODB.Connection
Public sql As String
Public rs, rss As New ADODB.Recordset
Public admission_no As Integer
Public view_student As Boolean = False
Public visitor_name, vdate, sname, comp, dat, stat
Public visitor As Boolean = False
Public complaint As Boolean = False
Public abc As String
Public Function OpenDB()
Try
If Conn.State = 1 Then Conn.Close()
conn.Open("Data Source=dawise1-pc\sqlexpress;Initial Catalog=hostel1;Integrated Security=True")
Return (0)
Catch ex As Exception
MsgBox("Database is not connected ..... Please Check Your Network Connection", MsgBoxStyle.Critical)
End
End Try
End Function
End Module
connecting using server explorer is not an issue it connects very well once connected, i checked the property windows of the database and this is what i saw
(name) hostel1
cse sensitive False
connection string: (Data Source=dawise1-pc\sqlexpress;Initial Catalog=hostel1;Integrated Security=True)
owner: (DAWISE1-PC\(DaWise1))
provider: (.NET Framework Data Provider for SQL Server)
state: Open
type: (Microsoft SQL Server)
version (10.00.2531)
an working on my final year project and am stock at this point. any idea would be appreciated. Thanks in advance

New Topic/Question
Reply



MultiQuote





|