How would u connect to database using .NET?
Answers were Sorted based on User's Feedback
Answer / rajeev ranjan lall
SqlConnection conn = new SqlConnection("Data
Source=ServerName;Initial Calalog=DatabaseName;User
ID=username;Password=password")
Is This Answer Correct ? | 15 Yes | 1 No |
Answer / ramakrishna
sqlconnection cn =new sqlconnection("uid=sa;pwd=sa;data
source=servername;database=databasename");
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / vivek
using Connection object
SqlConnectin cn=new SqlConnection();
from .net we can connect to any backend with middlleware
and direct connections.
middleware means ODBC,OleDb,ISAM etc.
we can directly connect to Sqlserver and Oracle
we can connect to sql server in 4 ways
1)direct connection
2)ODBC way
3)OleDb way
4)Express way
for oracle we can connect in 3 ways.
1)direct connection
2)ODBC way
3)OleDb way
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / lalitkumar
sqlconnection con=new
sqlconnection("@server=.sqlexpress;database=master;trusted_connection=yes")
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / rathish
go to project->add reference->adodb
DECLERATION
Dim con As ADODB.Connection
Dim cmd As ADODB.Command
Dim str, cnstr, sql As String
Dim cn As OleDb.OleDbConnection
FORM LOAD
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
con = New ADODB.Connection
con.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\new folder\employee.mdb")
End Sub
in the source you have to give the path of ur file name..
Is This Answer Correct ? | 1 Yes | 3 No |
Can we connect two dataadapters to same data source using single connection at same time?
How to bind the controls(best practice) comboboxes to the data in the dataset?
Name which operations can you not perform on an ado.net dataset?
How is entity framework different from ado.net?
What is a serialized object?
What is the Magic Tables in Sqlserver2000?
What are the differences between OLEDB and SQLClient Providers?
What does executenonquery () method return?
What are the advantages and drawbacks of using ado.net?
What are the key events of sqlconnection class?
Explain the role of data provider in ado.net?
What are the different execute methods of Ado.Net?