Click here to Skip to main content
15,887,283 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien868-May-10 10:47
Tunisien868-May-10 10:47 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Stanciu Vlad8-May-10 11:04
Stanciu Vlad8-May-10 11:04 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien868-May-10 11:19
Tunisien868-May-10 11:19 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Stanciu Vlad8-May-10 11:32
Stanciu Vlad8-May-10 11:32 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien868-May-10 12:23
Tunisien868-May-10 12:23 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien869-May-10 0:10
Tunisien869-May-10 0:10 
AnswerRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien8611-May-10 5:55
Tunisien8611-May-10 5:55 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Stanciu Vlad11-May-10 6:42
Stanciu Vlad11-May-10 6:42 
Hey,

Glad to see you've progressed!

I have a couple of commentaries:
1) 127.0.0.1 is the ip of the loopback interface, so if you use the loopback then you use no network (so this was a network problem, probably missing network connection?)
2) the data adapter da is not retriving any rows because it has no select command. You should use this line of code SqlCeDataAdapter da = new SqlCeDataAdapter(comm);
3) there is no use form the data reader dr
4) sql ce data adapter does not work with sql command or sql connection...
5) it is usefull to bind data to the combo box in order to maintain relation with your database entity.

I recommend this snippet of code:

string sConnection = "Data Source=127.0.0.1,1433;Persist Security Info=True;Initial Catalog=GMAO;User ID=sa;Password=sa";
string sSQL = "SELECT ID, com FROM energie";

SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
SqlDataAdapter da = new SqlDataAdapter(comm);

try
{
    DataSet ds = new DataSet();

    comm.Connection.Open();
    
    da.Fill(ds);
    
    comboBox1.DataSource = da.Table[0];
    comboBox1.DisplayMember = "com";
    comboBox1.ValueMember = "ID";
}
catch (SqlException ex)
{
    MessageBox.Show(ex.Message);
}
finally
{
    comm.Connection.Close();
}

I have no smart signature yet...

GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien8611-May-10 9:06
Tunisien8611-May-10 9:06 
QuestionNeed advice for improving performance and making an application more robust Pin
Daniel Jacinto8-May-10 4:21
Daniel Jacinto8-May-10 4:21 
AnswerRe: Need advice for improving performance and making an application more robust Pin
#realJSOP8-May-10 5:02
mve#realJSOP8-May-10 5:02 
Questionhelp about the formating of data to be written on a text file... Pin
aeroboy8-May-10 3:30
aeroboy8-May-10 3:30 
AnswerRe: help about the formating of data to be written on a text file... Pin
OriginalGriff8-May-10 3:54
mveOriginalGriff8-May-10 3:54 
GeneralRe: help about the formating of data to be written on a text file... Pin
aeroboy8-May-10 4:10
aeroboy8-May-10 4:10 
QuestionWhere is network login prompt populated from? Pin
DeepToot8-May-10 3:16
DeepToot8-May-10 3:16 
AnswerRe: Where is network login prompt populated from? Pin
Dave Kreskowiak8-May-10 3:29
mveDave Kreskowiak8-May-10 3:29 
QuestionHow Can I export data from DataGridView to Acrobat Reader ? Pin
HDas7-May-10 22:38
HDas7-May-10 22:38 
AnswerRe: How Can I export data from DataGridView to Acrobat Reader ? Pin
Richard MacCutchan7-May-10 22:52
mveRichard MacCutchan7-May-10 22:52 
GeneralRe: How Can I export data from DataGridView to Acrobat Reader ? Pin
DeepToot8-May-10 9:25
DeepToot8-May-10 9:25 
GeneralRe: How Can I export data from DataGridView to Acrobat Reader ? Pin
Richard MacCutchan8-May-10 10:02
mveRichard MacCutchan8-May-10 10:02 
Question3 tier app, data access layer, business logic layer Pin
sky39137-May-10 20:23
sky39137-May-10 20:23 
AnswerRe: 3 tier app, data access layer, business logic layer Pin
Peace ON7-May-10 21:25
Peace ON7-May-10 21:25 
GeneralRe: 3 tier app, data access layer, business logic layer Pin
sky39138-May-10 19:16
sky39138-May-10 19:16 
AnswerRe: 3 tier app, data access layer, business logic layer Pin
Stanciu Vlad7-May-10 22:39
Stanciu Vlad7-May-10 22:39 
GeneralRe: 3 tier app, data access layer, business logic layer Pin
sky39138-May-10 19:14
sky39138-May-10 19:14 

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.