Click here to Skip to main content
16,005,241 members
Home / Discussions / C#
   

C#

 
GeneralRe: Day Planner (Remainder) Sample Project Pin
Christian Graus22-May-07 20:39
protectorChristian Graus22-May-07 20:39 
AnswerRe: Day Planner (Remainder) Sample Project Pin
Expert Coming22-May-07 19:54
Expert Coming22-May-07 19:54 
QuestionEmail Attachment using Webbrowser Pin
maazfarooqui22-May-07 18:50
maazfarooqui22-May-07 18:50 
QuestionGetting new line in XML? Pin
chand1022-May-07 18:11
chand1022-May-07 18:11 
AnswerRe: Getting new line in XML? Pin
Christian Graus22-May-07 19:54
protectorChristian Graus22-May-07 19:54 
Questiondatetime comparison please help Pin
tyutr22-May-07 16:35
tyutr22-May-07 16:35 
AnswerRe: datetime comparison please help Pin
tyutr23-May-07 10:08
tyutr23-May-07 10:08 
QuestionError in Connection to DataBase Pin
Alireza383922-May-07 15:19
Alireza383922-May-07 15:19 
Hello,

I write a method in a class for connection to database and this method call in Login_Form


Code :

namespace DuryHouse
{

class Genral_Class
{

public string conection_string;



//Define Method for connect to Database
public string Conect_DataBase(
string servername,
string userid ,
string password
)
{

conection_string = "Data Source = " + servername +
";Network Library = DBMSSOCN;Initial Catalog = uryHouse;"
+ "User ID = " + userid + ";Password = " + password+"";
return conection_string;
}


}


}

In Login Form after pressing OK button I can not connect to DataBase :

private void button1_Click(object sender, EventArgs e)
{
Genral_Class Conection = new Genral_Class();
Conection.Conect_DataBase(ServerBox.Text, IDBox.Text, PassBox.Text);
sqlConnection1.ConnectionString = Conection.conection_string;
sqlConnection1.Open();
try
{
sqlCommand1.CommandText = "Login";
sqlCommand1.CommandType = CommandType.StoredProcedure;
sqlCommand1.Connection = sqlConnection1;
sqlCommand1.Parameters.Add(IDBox.Text, PassBox.Text);
}
catch (Exception ex)
{
Messagebox.Show(ex.message);
}

you think in which part I make mistake???


thanks

AnswerRe: Error in Connection to DataBase Pin
Expert Coming22-May-07 15:35
Expert Coming22-May-07 15:35 
GeneralRe: Error in Connection to DataBase Pin
Alireza383922-May-07 15:40
Alireza383922-May-07 15:40 
GeneralRe: Error in Connection to DataBase Pin
Expert Coming22-May-07 19:55
Expert Coming22-May-07 19:55 
GeneralRe: Error in Connection to DataBase Pin
Alireza383922-May-07 20:34
Alireza383922-May-07 20:34 
GeneralRe: Error in Connection to DataBase Pin
Expert Coming22-May-07 20:44
Expert Coming22-May-07 20:44 
QuestionCombine duplicates from an ArrayList Pin
InvalidTypecast22-May-07 15:18
InvalidTypecast22-May-07 15:18 
AnswerRe: Combine duplicates from an ArrayList Pin
Martin#22-May-07 19:40
Martin#22-May-07 19:40 
QuestionDirectX ClickEvent? Pin
Expert Coming22-May-07 15:00
Expert Coming22-May-07 15:00 
AnswerRe: DirectX ClickEvent? Pin
andre_swnpl22-May-07 21:24
andre_swnpl22-May-07 21:24 
QuestiondataGridView_DoubleClick Pin
balanjingot22-May-07 14:36
balanjingot22-May-07 14:36 
AnswerRe: dataGridView_DoubleClick Pin
Gopal.S22-May-07 18:27
Gopal.S22-May-07 18:27 
GeneralRe: dataGridView_DoubleClick Pin
balanjingot22-May-07 20:35
balanjingot22-May-07 20:35 
GeneralRe: dataGridView_DoubleClick Pin
Gopal.S22-May-07 21:01
Gopal.S22-May-07 21:01 
GeneralRe: dataGridView_DoubleClick Pin
balanjingot22-May-07 21:35
balanjingot22-May-07 21:35 
QuestionI'm getting demolished by an easy SELECT statement, help. Pin
ThisIsMyUserName222-May-07 14:10
ThisIsMyUserName222-May-07 14:10 
AnswerRe: I'm getting demolished by an easy SELECT statement, help. Pin
kubben22-May-07 14:21
kubben22-May-07 14:21 
GeneralRe: I'm getting demolished by an easy SELECT statement, help. Pin
ThisIsMyUserName222-May-07 14:33
ThisIsMyUserName222-May-07 14:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.