Click here to Skip to main content
15,913,610 members
Home / Discussions / C#
   

C#

 
AnswerRe: windows picture and fax viewer Pin
Dimitri Witkowski8-May-10 21:41
Dimitri Witkowski8-May-10 21:41 
RantSOLVED Pin
jojoba20118-May-10 23:35
jojoba20118-May-10 23:35 
Questionremember user name password in login form? [modified] Pin
charles henington8-May-10 19:28
charles henington8-May-10 19:28 
AnswerRe: remember user name password in login form? Pin
Stanciu Vlad8-May-10 20:58
Stanciu Vlad8-May-10 20:58 
QuestionSQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien868-May-10 4:58
Tunisien868-May-10 4:58 
AnswerRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Abhinav S8-May-10 5:21
Abhinav S8-May-10 5:21 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien868-May-10 5:58
Tunisien868-May-10 5:58 
AnswerRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Abhinav S8-May-10 9:06
Abhinav S8-May-10 9:06 
AnswerRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Stanciu Vlad8-May-10 6:34
Stanciu Vlad8-May-10 6:34 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Tunisien868-May-10 10:02
Tunisien868-May-10 10:02 
GeneralRe: SQL server name not found:Admin-PC\MSSQLSERVER,1433 Pin
Stanciu Vlad8-May-10 10:15
Stanciu Vlad8-May-10 10:15 
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
professional#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 

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.