Click here to Skip to main content
15,904,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am new to coding...I am trying to connect my db from front end...I have installed oracle 11g in my system...I am using this

C#
string constring = "Data Source=?;User Id=database user id;Password=mypaswrd;";
SqlConnection conn = new SqlConnection(constring);
conn.Open();



but I dont know my data source...from where i can find out my data source...or what i can use there....or without datasource whether connecting to db is possible?..

Please help...
Posted
Updated 17-Sep-11 2:23am
v2
Comments
rkthiyagarajan 17-Sep-11 7:04am    
Data Source is connection bridge of your database and your Web application or some thing like that.

Take a look at the following link for connection string samples for Oracle :

connection string samples
 
Share this answer
 
Comments
Arghya Santra 17-Sep-11 7:25am    
But I want to know what is the data source???....and for my connection string what i can use???...in that link there are some datasource names...from where they are getting that???...
Mehdi Gholam 17-Sep-11 8:03am    
datasource is the oracle server name
Datasource is the address of our database server..

for using local database you can write a local or put only .(dot) insted of writing some thing...

look at my connection string for demonstartion

C#
"Data Source=.;Initial Catalog=MyEcommerce;Integrated Security=True"

or 
"Data Source=(local)\SQLEXPRESS;Initial Catalog=MyEcommerce;Integrated Security=True"

or 
"Data Source=Tejas-Laptop\SQLEXPRESS;Initial Catalog=MyEcommerce;Integrated Security=True"
 
Share this answer
 
Comments
Arghya Santra 17-Sep-11 7:30am    
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button_transmit_Click(object sender, EventArgs e)
{
string user_id = TextBox_userid.Text;
string paswrd = TextBox_password.Text;
string constring = "Data Source=.;User Id=Arghyauserid;Password=ArghyaPaswrd;";
SqlConnection conn = new SqlConnection(constring);
conn.Open();
}
}


My code is above...Still its not connecting...
m@dhu 17-Sep-11 7:44am    
I don't think you can connect oracle db with sqlconnection.
Arghya Santra 17-Sep-11 7:48am    
@Madhu: Could you give me an example to connect oracle....
rkthiyagarajan 17-Sep-11 20:34pm    
Why need to oracle? SQL also better one, and you put the code also SQL...

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