Click here to Skip to main content
15,896,912 members
Home / Discussions / C#
   

C#

 
AnswerRe: HOW TO RETRIVE ALL TRANSACTION from sqlserver where TODAYS DATE AS PARAMETER IN SQL QUERY.? Pin
PIEBALDconsult21-Apr-10 3:24
mvePIEBALDconsult21-Apr-10 3:24 
GeneralRe: HOW TO RETRIVE ALL TRANSACTION from sqlserver where TODAYS DATE AS PARAMETER IN SQL QUERY.? Pin
Keith Barrow21-Apr-10 3:25
professionalKeith Barrow21-Apr-10 3:25 
GeneralRe: HOW TO RETRIVE ALL TRANSACTION from sqlserver where TODAYS DATE AS PARAMETER IN SQL QUERY.? Pin
PIEBALDconsult21-Apr-10 15:27
mvePIEBALDconsult21-Apr-10 15:27 
QuestionOrdering sub-elements in a PropertyGrid Pin
Wags21-Apr-10 0:57
professionalWags21-Apr-10 0:57 
AnswerRe: Ordering sub-elements in a PropertyGrid Pin
DaveyM6921-Apr-10 1:07
professionalDaveyM6921-Apr-10 1:07 
GeneralRe: Ordering sub-elements in a PropertyGrid Pin
Wags21-Apr-10 1:38
professionalWags21-Apr-10 1:38 
GeneralRe: Ordering sub-elements in a PropertyGrid Pin
DaveyM6921-Apr-10 2:08
professionalDaveyM6921-Apr-10 2:08 
GeneralRe: Ordering sub-elements in a PropertyGrid Pin
Wags21-Apr-10 2:15
professionalWags21-Apr-10 2:15 
GeneralRe: Ordering sub-elements in a PropertyGrid Pin
DaveyM6921-Apr-10 2:20
professionalDaveyM6921-Apr-10 2:20 
QuestionRegexp dilema Pin
skelmannen21-Apr-10 0:37
skelmannen21-Apr-10 0:37 
AnswerRe: Regexp dilema Pin
J4amieC21-Apr-10 1:38
J4amieC21-Apr-10 1:38 
GeneralRe: Regexp dilema Pin
skelmannen21-Apr-10 2:43
skelmannen21-Apr-10 2:43 
AnswerRe: Regexp dilema Pin
PIEBALDconsult21-Apr-10 3:30
mvePIEBALDconsult21-Apr-10 3:30 
GeneralRe: Regexp dilema Pin
skelmannen21-Apr-10 3:41
skelmannen21-Apr-10 3:41 
GeneralRe: Regexp dilema Pin
PIEBALDconsult21-Apr-10 7:58
mvePIEBALDconsult21-Apr-10 7:58 
AnswerRe: Regexp dilema Pin
Kythen21-Apr-10 6:00
Kythen21-Apr-10 6:00 
GeneralRe: Regexp dilema Pin
skelmannen21-Apr-10 21:28
skelmannen21-Apr-10 21:28 
QuestionStorage card in the emulator Pin
bacem smari20-Apr-10 23:53
bacem smari20-Apr-10 23:53 
AnswerRe: Storage card in the emulator Pin
Michel Godfroid21-Apr-10 2:03
Michel Godfroid21-Apr-10 2:03 
RantRe: Storage card in the emulator Pin
bacem smari21-Apr-10 2:54
bacem smari21-Apr-10 2:54 
AnswerRe: Storage card in the emulator Pin
bacem smari21-Apr-10 3:48
bacem smari21-Apr-10 3:48 
QuestionAdd checkboxs dynamically in csharp smart device project Pin
Tunisien8620-Apr-10 23:28
Tunisien8620-Apr-10 23:28 
GeneralRe: Add checkboxs dynamically in csharp smart device project Pin
Tunisien8621-Apr-10 5:26
Tunisien8621-Apr-10 5:26 
Hi,
After some search,I elaborate this code that still annoying Cry | :(( me with some errors:
private void button1_Click(object sender, EventArgs e)
        {
            //Create the connection
            string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";
            SqlCeConnection sqlceconn = new SqlCeConnection(wCS);

            //Create the command
            SqlCeCommand command = sqlceconn.CreateCommand();
            command.CommandText = "Select NBT, Nature from Travaux where NBT=@NBT ";

            //Add the parameters
            string s1 = textBox1.Text; //store the login name here YOU MUST FILL THIS IN
            SqlCeParameter NBT = new SqlCeParameter("@NBT", SqlDbType.NVarChar);
            NBT.Value = s1;

            command.Parameters.Add(NBT);
            //Create the adapter
            SqlCeDataAdapter adapter = new SqlCeDataAdapter(command);

            //Create and fill the dataset
            DataSet ds = new DataSet();

            try
            {
                adapter.Fill(ds, "SQL Temp Table");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            foreach (DataRow da in adapter)
            { string s = adapter["Nature"]; }

            if ((ds.Tables.Count > 0) && (ds.Tables["SQL Temp Table"] != null))
            {
                MessageBox.Show("Number of row(s) - " + ds.Tables["SQL Temp Table"].Rows.Count);
                if (ds.Tables["SQL Temp Table"].Rows.Count > 0)
                {
                    MessageBox.Show("Numéro de BT trouvé");
                    SqlCeCommand command1 = sqlceconn.CreateCommand();
                    command1.CommandText = "Select NoEtape, Etape from Travaux where TypeTravail=@typ ";

                    //Add the parameters
                    string s2 = textBox1.Text; //store the login name here YOU MUST FILL THIS IN
                    SqlCeParameter Typ = new SqlCeParameter("@Typ", SqlDbType.NVarChar);
                    Typ.Value = s2;

                    command1.Parameters.Add(Typ);
                    SqlCeDataAdapter adapt = new SqlCeDataAdapter(command1);

                    //Create and fill the dataset
                    DataSet dat = new DataSet();

                    try
                    {
                        adapt.Fill(dat, "SQL Temp Table");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    foreach (DataRow ligne in adapt.)
                    {
                        System.Console.WriteLine(adapt[0]);
                    }


                    
                }
                else MessageBox.Show("Veuillez saisir un autre NBT");
            }
            adapter.Dispose();
            sqlceconn.Dispose();
            command.Dispose();

        }


The errors are those Sigh | :sigh:
Error	1	foreach statement cannot operate on variables of type 'System.Data.SqlServerCe.SqlCeDataAdapter' because 'System.Data.SqlServerCe.SqlCeDataAdapter' does not contain a public definition for 'GetEnumerator'	C:\Users\Admin\Documents\Visual Studio 2008\Projects\GMAOMobile\ModeDifféré\Travail.cs	
Error	2	Cannot apply indexing with [] to an expression of type 'System.Data.SqlServerCe.SqlCeDataAdapter'	C:\Users\Admin\Documents\Visual Studio 2008\Projects\GMAOMobile\ModeDifféré\Travail.cs	
 Error	3	foreach statement cannot operate on variables of type 'System.Data.SqlServerCe.SqlCeDataAdapter' because 'System.Data.SqlServerCe.SqlCeDataAdapter' does not contain a public definition for 'GetEnumerator'	C:\Users\Admin\Documents\Visual Studio 2008\Projects\GMAOMobile\ModeDifféré\Travail.cs	

 Error	4	Cannot apply indexing with [] to an expression of type 'System.Data.SqlServerCe.SqlCeDataAdapter'	C:\Users\Admin\Documents\Visual Studio 2008\Projects\GMAOMobile\ModeDifféré\Travail.cs	

Thanks a lot for u suggestions:
Questiontype casting a string to a type which is getting received in a string Pin
dashingsidds20-Apr-10 23:20
dashingsidds20-Apr-10 23:20 
AnswerRe: type casting a string to a type which is getting received in a string Pin
surender.m20-Apr-10 23:34
surender.m20-Apr-10 23:34 

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.