Wednesday, April 30, 2014

How Can : Fill ComboBox items with FieldNames from a Table?

مثال بسيط
..Caption Is The Solution  :*  ;)  

   string constr = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Library  System;Data Source=.";

            SqlConnection con = new SqlConnection(constr);
            con.Open();
            SqlCommand scm = new SqlCommand();
            scm.Connection = con;
             
            {
                 scm.CommandText = "select Subject,Title ,Author from Books ";
                DataTable dt = new DataTable();
                SqlDataAdapter adpt = new SqlDataAdapter(scm);
                adpt.Fill(dt);
           
               
                for (int i =0; i<dt  .Columns .Count  ; i++)
                {
                    comboBox1.Items.Add(dt.Columns[i  ].Caption);

                }

Tuesday, April 29, 2014

How To convert :TextBox value To Image C#


        public Color FontColor { get; set; }
        public Color FontBackColor { get; set; }
        public string FontName { get; set; }
        public string ImagePath { get; set; }
        public int FontSize { get; set; }
        public int ImageHeight { get; set; }
        public int ImageWidth { get; set; }
        public Bitmap ImageText { get; set; }
        public Graphics ImageGraphics { get; set; }
        public Font ImageFont { get; set; }
        public SolidBrush BrushForeColor { get; set; }
        public SolidBrush BrushBackColor { get; set; }
        public PointF ImagePointF { get; set; }

        private void DrawText(string text)
        {
            FontColor = Color.Red;
            FontBackColor = Color.Yellow;
            FontName = "Arial";
            FontSize = 10;
            ImageHeight = textBox1.Height;
            ImageWidth = textBox1.Width;
                        //saveimage in bin of the project with textbox name content
            ImagePath = Application.StartupPath + "\\" + textBox1.Text + ".JPEG";

            //this for save image in ecery place you need ..Name of image ==textbox value
            // ImagePath =  @"C:\"+textBox1 .Text +".JPEG";

            ImageText = new Bitmap(ImageWidth, ImageHeight);

            ImageGraphics = Graphics.FromImage(ImageText);

            ImageFont = new Font(FontName, FontSize);
            ImagePointF = new PointF(5, 5);
            BrushForeColor = new SolidBrush(FontColor);
            BrushBackColor = new SolidBrush(FontBackColor);

            ImageGraphics.FillRectangle(BrushBackColor, 0, 0, ImageWidth, ImageHeight);
            ImageGraphics.DrawString(text, ImageFont, BrushForeColor, ImagePointF);

            ImageText.Save(ImagePath, ImageFormat.Jpeg);
        }


        private void button1_Click(object sender, EventArgs e)
        {
            DrawText(textBox1.Text);
        }


Search In Data Base to Return data From pecified Table

  //Start
            //search for the book
            string constr = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Library System;Data Source=.";
            SqlConnection con = new SqlConnection(constr);
            con.Open();
            SqlCommand scm = new SqlCommand();
            scm.Connection = con;
           //  select fields that we need to Make search Of It
          /*we have table called Books with columan name Subject,Title, Author
          ,Publisher ,CopyRight ,Edition and ID
           */
          scm.CommandText = "select Subject,Title, Author ,Publisher ,CopyRight ,
          Edition  from   Books    Where ID ='"+txt_id.Text  +"'";
        
          SqlDataReader dr = scm.ExecuteReader();
          
         //get data in text box for eash field that will Return when making search with id 
          while (dr.Read())
            {
                textBox_Subject.Text = dr["Subject"].ToString();
                textBox_Title.Text = dr["Title"].ToString();
                textBox _Author.Text = dr["Author"].ToString();
                textBox_Publisher.Text = dr["Publisher"].ToString();
                textBox_CopyRight.Text = dr["CopyRight"].ToString();

                textBox_Edition.Text = dr["Edition"].ToString();
                
            }

Friday, March 21, 2014

allow textbox accept (Float-decimal) number c# windows application

private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!char.IsDigit(e.KeyChar) && e.KeyChar != '.')
                e.Handled = true;
            base.OnKeyPress(e);
        }

allow textbox accept only Number c# Windows Application

//allow digits only
            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
            {
                e.Handled = true;
            }

Tuesday, March 18, 2014

saving changes is not permitted. the changes you have made require the following tables to be dropped and re-created

Go To Tools -->Options
ANd CHoose It
Designer-->Table And Data Base..- > Uncheck Prevent Saving Changes That Reguire Table re-Creation...



Open Link
http://arabteam2000-forum.com/index.php/topic/279453-%D8%B7%D9%84%D8%A8-%D9%85%D8%B3%D8%A7%D8%B9%D8%AF%D8%A9-%D9%81%D9%8A-%D8%AA%D9%88%D8%B6%D9%8A%D8%AD-%D9%85%D8%B4%D9%83%D9%84%D8%A9/

Friday, March 14, 2014

How can multiply two value in sql in row and put the result in the another cell in the same row?

I have table called 'Task'
have four column (id , x, y and x*y)
i only enter the values (id, x and y)
need trigger or other thing when i entered the values calculate automatic the value 'x*y'
thanks ,


answer 1
You can use Computed columns to achieve your goal.
CREATE TABLE Task(Id int, x int, y int, xy as x* y);
 
 
answer 2
 CREATE TRIGGER T_task on task
instead of insert
as
    insert into task (id,x,y,[x*y] /* Really need to rename this */)
    select id,x,y,x*y from inserted 

Thursday, March 13, 2014

Fill gride view with DataTable

DataTable dt = new DataTable() ;
           
            string constring = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=POS;Data Source=.";
           
            SqlConnection con = new SqlConnection(constring);

            con.Open();

            SqlCommand scm = new SqlCommand();
            scm.Connection = con;
         
           scm .CommandText= "select Max(id) from Add_item";
       
           SqlDataAdapter dA = new SqlDataAdapter(scm  );
           
     
          dataGridView1.DataSource = dt;

Monday, February 17, 2014

الفرى لانسنج

 
[Freelancing - الجزء الاول ]
معنى الFreelancing
--------------------------
اول حاجة لازم نعرفها ف الاول يعنى ايه Freelancing وهل هو معتمد على مجال معين او لاشخاص بعينهم .. معنى الفرى لانسنج انى بقدم خدمة بمقابل مادى , الخدمة دى ممكن تقعد ساعه يوم شهر على حسب حجم المشروع .. طبعا الخدمة مش مقتصره على مجال معين ممكن يبقى برمجة تصميم كتابة ترمجة وهكذا ... طالما بقدر اعمل خدمة بمقابل مادى .. تانى حاجة لازم الشخص اللى بيدخل فى الفرى لانسنج يكون عنده خبره كويسه جدا فى المجال اللى هو هيشتغل فيه بحيث يبقى مدرك الاخطاء اللى ممكن يقع فيها لان انت دلوقتى " حر نفسك " و انت اللى بتتعامل مع العملا مباشرة يعنى انت اللى بتدير المشروع و دى مش اى حد يقدر يستحملها

ازاى اجهز لنفسى عشان اقدر ابقه Freelancer
-----------------------------------------------------
كده احنا عرفنا معنى الفرى لانسنج و وايه المقصود بيها .. دلوقتى عايزين نعرف ازاى اجهز نفسى للموضوع ده ؟؟!! اول حاجة انك تشهر نفسك فى مجالك على اوسع نطاق وهنا بقه يجى اكتر من حاجة زى مثلا
*** مواقع التواصل الاجتماعى : انى اتكلم مع ناس فى نفس مجالى واكتر من خبرة عشان اعرف ازاى وصلوا للخبره دى .. اتناقش مع ناس فى جروبات فى مشاكل معينه .. ارد على استفسارات ناس وهكذا .. تانى حاجة انى ممكن اعمل بيدج و انشر عليها اعمالى بأستمرار وافيد الناس وبرده انا استفيد , دى حاجة مختصرة عن اهمية ال Social Media .. يعنى ركز كل طاقتك ومجهودك وبرده شغلك على حاجة معينه زى مثلا Facebook , Twitter , Google+, LinkedIn وغيرهم
*** موقع شخصى : النقطه دى فى غاية الاهمية لاكتر من سبب ان انت بتنشر اعمالك على الموقع بأستمرار وبتخلى الناس توصلك بسهولة على طريق محركات البحث و ده فى حد ذاته من اهم النقاط عشان تشهر نفسك فى مجالك
*** الكروت الشخصية: الموضوع ده يمكن يكون فات عليه الزمن شوية لكن لسا فيه ناس كتير بتستخدمه على نطاق معين لان انت بتحاول تشهر نفسك وتعرف الناس عليك فى حدود منطقه معينه مش كل الناس
*** لوجو شخصى : حاول تعمل ليك لوجو او حاجة زى Watermark تبقى على اعمالك بحيث اللى يشوفه يعرف انك عامله وبتأكد من ده
دى طبعا بعض الحاجات اللى بتساهم بشكل كبيييير جداااا فى انك توصل للناس بسهولة وخصوصا العملاء لو انت استغلت النقط اللى فاتت دى صح ف انت كده ماشى ناحية هدفك بسهولة وبسرعه ان شاء الله

و دى كانت نبذة بسيطه جدا عن موضوع الفرى لانسنج و ايه هو وازاى اهيأ نفسى له .. اتمنى يكون عجبكم المقال و أسف ع الاطالة .. هستنى ردكم و ارائكم فى الكلام ده .. وان شاء لله المقال الجاى هيبقى عن " ازاى اجيب العملاء " عشان ابدأ اشتغل فى مجالى
والسلام عليكم ورحمه الله وبركاته
 
.................................................................
[Freelancing - الجزء الثانى]
ازاى ابنى اسم ليا فى السوق
-------------------------------------
السلام عليكم ورحمه الله وبركاته , كنا اتكلمنا المرة اللى فاتت عن معنى الفرى لانسنج و ازاى تجهز وتهيأ نفسك لدخول المرحله دى . دلوقتى هنيجى لحاجة مهمه جدا وهى ازاى تلاقى عملا فى المجال اللى انت شغال فيه؟! لان بدون عملا مفيش شغل :
-------------------------------------
طيب دلوقتى فى اكتر من طريقه عشان تلاقى عملا احنا كنا قولنا قبل كده من احد الحاجات عشان تشهر نفسك هى الكروت الشخصية و ده هيساعدك انك توصل للناس اللى حواليك وخليك على تواصل دائم بينهم بمعنى انك تعرفهم ايه تخصصك بالظبط وايه اخر مشاريعك يعنى من الاخر تعرفهم انت مين ؟! طبعا لو ليك علاقات بأفراد واصدقاءاو زمايل دراسه كتير ده هيسهل عليك جدا فى الاول انك تلاقى شغل و حاول تعرض عليهم بأستمرار شغلك و دى حاجة مهمه جدا فى الاول
-------------------------------------
تانى حاجة : مواقع الفرى لانسنج زى Freelancer.com, oDesk, Elance وهكذا المواقع دى عباره عن عملا بتعرض مشاريع وانت بتقدم فيها وبتكلم العملا شخصيا (انا مش بفضل الطريق ده لاسباب كتير هنفصلها بعدين كلها)
-------------------------------------
اتواصل مع الناس عن طريق الفيس بوك مثلا والبيدجات , كلم اصحاب الشركات الجديده والصغيره واعرض عليهم خدماتك . كلم افراد او رجال اعمال .. او ممكن تتواصل معاهم عن طريق الايميلات المهم توصلهم خدماتك بصورة احترافية . للعلم بس ركز ع الفيس بوك والجروبات لان فى ناس كتير بتطلب مساعدات وشغل ع الجروبات دى وانا ان شاء الله هعمل قائمه مفصله بأشهر الصفحات والجروبات اللى ممكن تلاقى شغل من خلالها فى اول الطريق
-------------------------------------
طريقه تانية .. و دى نقطه مهمه جدا وغير مستغلة عند الناس (لينكد ان- LinkedIn) دى شبكة اجتماعية لرجال الاعمال وللشركات وسهل جدا تلاقى ناس محتاجين خدماتك سواء افراد او شركات , كل اللى مطلوب منك انك تظبط البروفايل بتاعك وتنشر اخر اعمالك وتنشر معلوماتك وتعرف الناس الخدمات اللى انت بتقدمها . يعنى حاول تقضى وقت مع لينكد ان فعلا هيفيدك جدا
-------------------------------------
تويتر : دة برده الغائب الحاضر انك ممكن من تويتر بس تعمل علاقات مع عملا ويبقى ليك سمعة فى مجالك لانك بتعمل تويتات بتعرف الناس شخصيتك وشغلك وكل حاجة عنك و ده برده موضوع طويل و هيبقى له سلسلة لوحده ان شاء الله
-------------------------------------
للناس المهتمه بالبرمجة والديزاين وال Computer Science عموما .. فى مواقع اسئلة واجوبة حاول تعمل عليها شخصية وسمعه ليك عن طريق اجاباتك وافادتك للناس بصورة واضحه جدا يعنى حاول تخصص جزء من وقتك فى اليوم انك تدخل ترد ع الاستفسارات دى بحيث تعرف الناس برده عليك المواقع دى زى Stackoverflow – Yahoo Answers وغيرهم ...
-------------------------------------
الخاتمه والمخلص : انك حاول تشهر نفسك بأى طريقه من الطرق السابقه او غيرها بحيث خدماتك توصل لاكبر عدد من الناس ..

يارب تكونوا استفادتم من المقال ده و اكون وضحت ليكم نقاط مهمه ..
(اى حاجة قولت عليها هتتوضح لوحدها فى دى هيبقى ليها مقال او مجموعة مقالات على النقطه او الحاجة دى بس )
والسلام عليكم ورحمه الله وبركاته.
..........................................................
 
[الجزء التالت - شرح ال Freelancing]
ازااى اعرف تكلفة ومدة المشروع
-------------------------------------
السلام عليكم ورحمة الله وبركاته
كنا اتكلمنا فى الجزئين اللى فاتوا عن معنى الفري لانسنج و ازاى اهيأ نفسه له , غير اننا عرفنا الطرق اللى ازاى نقدر نجيب بيها العملا فى المجال بتاعنا .. طيب دلوقتى هنفترض ان جالنا العملا وبقه معانا مشروع , طبعا العميل بيطلب منك تكلفة المشروع ومدته و دى مشكله عند معظم الناس بيحاولوا يقولوا اقل سعر ممكن و ده بيخلى العميل يشك ف مهاراتك و انك بتقول اى سعر وخلاص وانت متعرفش تعمل حاجة ! .. ياما تقول سعر اعلى وده بيخلى العملا ياخد عنك انطباع انك استغلالى ومش هيتعامل معاك تانى وبالتالى انت خسرت مشروع وعميل .. ف دلوقتى انا هتكلم عن ازاى تحدد تكلفة المشروع ومدته (بنظام الساعات) بكل بساطه مثلا مطلوب منك موقع معين بتشوف خصائص الموقع ده وكل جزء تقدر تعمل ف اد ايه و تبقى عامل حسابك فى مده ازيد شوية احتياطى .. دلوقتى تعمل ملف اكسل عادى وتكتب فيه كل خصائص الموقع ده جزء جزء وتكتب ادام كل جزء من ده هياخد منك كام ساعه فى اليوم يعنى لو انت عامل حسابك هتشتغل 4 ساعات فى اليوم والجزء ده هياخد منك 20 ساعه ف كده معناه انك هتشتغل 5 ايام .. والجزء اللى بعده هتعمله نفس النظام لحد اخر المشروع ف مثلا طلع المشروع هياخد منك 100 ساعه وانت بتشتغل 4 ساعات فى اليوم ف كده المشروع هياخد منك 25 يوم .. طيب بالنسبة للتكلفة هتضرب ال 100 ساعه فى تمن الساعه الواحده .. جميل , ازاى احدد تمن الساعه بتاعتى ؟!! (سؤال حلو ) .. ده بيعتمد على اكتر من حاجة :
- بتسأل الناس اللى اكبر مك واكتر خبره فى المجال ده وتشوف ساعتهم بتكون بأد ايه بحيث لا تبقى عامل تمن الساعه اعلى منهم بكتير ولا اقل منهم بكتير اوى انت بتقارن خبره الناس دى بخبرتك وانت ساعتها تقدر تحدد ..
- بتشوف المشروع ده هل هو له اشخاص كتير جدا بيعملوه وممكن العميل يلاقى اى حد غيرك يشتغله فى المشروع ده ف ساعتها بتراعى المنافسه القوية وبتظبط سعرك على اساسه انما بقه انت لو محظوظ وناس قليله جدا او نادره بتشتغل فى الجزء ده ف ممكن تعلى السعر شوية لان العميل صعب اوى يلاقى غيرك يشتغله فى المشروع ده
بالاخذ فى الاعتبار .. دايما افترض اسوأ ظرف يعنى متقولش الجزء ده هياخد منى 3 ساعات بالظبط لا ادى لنفسك وقت احتياطى عشان لو حصل اى حاجة عطلتك عن الشغل

وبكده يبقى حددنا تكلفة و مده المشروع .. والسلام عليكم ورحمه الله وبركاته
.................................................................................
 
 
 
 
 
[ الجزء الرابع - شرح الفرى لانسنج]
ازاى تحدد سعر البروجكت ؟ فى اربع طرق
- اول طريقه هى Time-based
يعنى بتشوف البروجكت ده هياخد كام ساعه عن طريق انك بتقسمه اجزاء وبتشوف كل جزء هياخد وقت اد ايه وفى الاخر بتحسب عدد الساعات الكلى وبعدين بتضرب عدد الساعات الكلى فى سعر الساعه الواحده (هتكلم عنها فى المقال الجاى بالتفصيل الممل عشان ليها اكتر من طريقه)
- تانى طريقه Project Type
يعنى بتشوف نوع البروجكت ده ايه ؟ بمعنى ؟ ان لو البروجكت ده لشركه غير انه يكون يكون لشخص او طالب مثلا
انت بتكون عامل نظام ال Packing, على سبيل المثال بتقول انا هعمل موقع مع اللوجو بتاعه بسعر فلانى وبتعرض خدمات دى وممكن تعمل عليها اوفر لناس معينه او لعملا انت اشتغلت معاهم قبل كده

- تالت طريقه هى Value-based
يعنى اهمية البروجكت ده والطلب عليه فى السوق ايه , يعنى لو البروجكت ده فى ناس كتير جدا بتعرف تعمله ف طبيعى انك تقلل السعر عشان المنافسه انما لو البروجكت قليل اوى اللى فاهم فيه او يعرف يعمله ف دى فرصتك انك تتعامل على النقطه دى

-رابع طريقه Running Project
بمعنى انك بتدور ع النت لبروجكت مشابه وتشوف معمول بكام وايه المعايير اللى خلت البروجكت بالسعر ده , او ببساطه تسأل حد متخصص وتعرف خبرتك اد ايه وتقوله عايز سعر مناسب للبروجكت ده

كل دى معايير عشان تقربلك ازاى تسعر البروجكت بتاعك , حاول تشوف بروجكت اوبن سورس ع النت وتتعامل على اساس ان فيه عميل طالبه منك وتسعر وتستشير الناس هل السعر ده مناسب ولا , يعنى درب نفسك كتير ع الموضوع ده
اسف ع الاطالة وان شاء الله المقال الجاى هيبقى ازاى تحدد سعر الساعه

-انا موجود لأى استفسار ان شاء الله
والسلام عليكم ورحمه الله وبركاته
..............................................
..........................................................
[الجزء الخامس من شرح الفرى لانسنج]
- المرة اللى فاتت كنا اتكلمنا عن ازاى تحدد سعر المشروع وتحدد مدته طيب جميل دلوقتى هنيجى لحاجة مهمه جدا وهى انا عشان اعرف احدد سعر المشروع لازم اعرف هياخد كام ساعه واعتقد دى لبعض الناس سهله بأنهم يقسموها تاسكات وهكذا زى ماتكلمنا المرات اللى فاتت او ع الاقل يسأل حد , طيب تانى حاجة لازم اعرف سعر الساعه بتاعتى .. عشان احدد سعر الساعه ده له اكتر من طريقه بس هنركز فى السلسلة دى على طريقتين بس تجنبا لاى لغبطه او تعقيد ع الناس ,
اول طريقه : هى انك تحدد ساعتك بناء على مجالك اللى انت فيه وعلى خبرتك وعلى برده المشروع ودى بالنسبة للناس اللى لسا مبتدئين صعبه شوية لانها بتطلب شوية خبره ومعرفة سابقه وكنت اتكلمت عن النقطه دى فى الجزء التالت
تانى طريقه : و دى اللى بفضل تمشوا بيها فى الاول بس تحكموا عقلكم فيها عشان متظلمش نفسك ولا تظلم العملا بتوعك , وهى انك بتجيب ورقه وقلم وبتحسب انك ناوى تشتغل كام ساعه يوميا وعلى ده بتحدد هتشتغل كام ساعه فى الاسبوع وفى الشهر (خد بالك فى اجازات زى يوم الجمعه مثلا او اى حد ممكن تعطلك ف اعملك احتياطاتك) بتشوف اجمالى الساعات اللى انت هتشتغلها فى الشهر , بعد كده بتشوف انت كامبتدأ محتاج تحقق دخل كام شهر 1000 جنيه 2000 وهكذا على حسب بعد كده هتقسم المرتب ده على عدد الساعات وبالتالى هيطلعلك سعر الساعه الواحده ..
اهم من ده اولا .. انك لازم تاخد بالك من انك متجيش تقول انا عايز احقق 10 الاف جنيه ف كده هتعلى السعر و ده براحتك طبعا لكن مفيش اى عملا هتجيلك او تقلل سعرك جدا ف العملا تشك فى خبرتك ومهاراتك ف الحالتين مرفوضين وحاول تبقى متوازن فى تحديد مرتبك
ثانيا .. انك تشتغل فعلا الساعات اللى انت محددها يوميا وتاخد اجازاتك اللى انت برده محددها عشان متظلمش نفسك ولا تظلمك غيرك .. اعتقد الطريقه دى سهله شوية عن اللى فاتت ويارب تكون افادتكم
والسلام عليكم ورحمه الله وبركاته
..........................................
...................................
[الجزء السادس من شرح الفرى لانسنج - نصايح عامة للبداية]

السلام عليكم ورحمه الله وبركاته , الاجزاء اللى فاتت كنا اتكلمنا معنى الفرى لانسنج وازاى تسوق لنفسك وتحدد سعر المشروع وهكذا , المرادى هتبقى مختلفه شوية او هتبقى نقطه فاصله للاجزاء الجاية والشغل اللى جاى .. هى اهم النصايح اللى لازم كل واحد ياخد باله منها
قبل ما تبدأ فى ال Freelancing

1 - اهتم جدا باللى السوق محتاجه فى مجالك بمعنى انك متبقاش ماشى فى اتجاه كل الناس ماشية العكس يعنى مثلا متستخدم لغة قديمه جدا مبقاش حد يستخدمها لان ببساطه مش هتلاقي عليها اقبال ولا عملا يطلبوا الشغل بيها .. ف ادرس السوق دايما
2- اياك والعمل المجانى .. متقولش انا لسا مبتدأ ف هشتغل كام مشروع كده ببلاش عشان ازود خبرتى وازود العملا بتوعى الكلام ده غلط جدا لان بمجرد ان العملا يعرفوا انك بتشتغل ببلاش ف هيقابلك نوعين من العملا , النوع الاول الاستغلالى اللى هو عايز يخليك تعمله اى شغل وخلاص طالما ببلاش , النوع التانى اللى هيشك فى مهاراتك ومش هيخليك تعمله اى شغل وبالتالى فى الحالتين انت اللى خسران
3- لازم يبقى ليك CV محترم جدا , Portfolio , موقع يعرض اعمالك , LinkedIn account .. شوف ايه اللى يناسبك منهم واجتهد فيه وطلعه بأحسن شكل.. ويفضل تعمل كل ده
4- اعمل Blog عرف الناس بالخدمات اللى انت هتقدمها ليهم فى المجال .. اعرض اى مشاكل قابلتك فى المجال وده وقول انت اتغلبت عليها ازاى بحيث اللى يقع فى نفس المشكله يرجعلك
5- ثق بنفسك .. واعرف انك ممكن تعمل احسن شغل واحسن من اى حد .. لانك لو موثقتش فى نفسك وفى شغلك , ازاى الناس هتثق فيك ؟!
6 - حاول توازن بين انك تتعلم حاجة وبين الشغل وبين حياتك الشخصية عشان مفيش حاجة تيجى على التانية وتبقى خسرت حاجات كتير
7- حاول يبقى ليك تواجد كويس على ال Social Media .. انشر حاجات تفيدك وتفيد الناس مش مجرد اى بوست وخلاص .
8 - نظم وقتك , مضيعهوش فى حاجات ملهاش لازمه .. وافتكر Time is money
9 - علم الناس .. احسن طريقه لاسترجاع المعلومه هى انك تعلمها لحد بحيث وقت مايسألك فيها انت كمان هتستفاد لانك هتعمل Refreshment للمعلومة تانى
10 - اشتغل فى مشاريع فى مجالك بحيث تعرضها ف ال Portfolio بتاعك وطلع احسن ما عندك فيهم لان دول عنوانك ادام العملا وادام الناس اللى هتتفرج على شغلك
11 - اتعلم , اتعلم , اتعلم .. خليك دايما Up-to-dated بالتقنيات الجديدة فى مجالك
12 - لكل الناس اللى بتقول انا لسا متخرج جديد ومش عارف اعمل ايه وتايه جدا جدا .. يارييييت تركز على نقط 10 و 11 جدا جدا لان دول هما اللى هيجبولك الشغل والعملا ..
واخيرا الصبر مفتاح الفرج

يارب تكون المقاله دى عجبتكم وفادتكم .. انتظروا الاجزاء القادمة
والسلام عليكم ورحمه الله وبركاته
................................................
[الجزء السابع من شرح الفرى لانسنج - لحظة الانطلاق والبداية ]
الاجزاء اللى فاتت اتكلمنا عن معنى الفرى لانسنج , وازاى تعمل لنفسك و سمعه بين الFans اللى عندك عشان بعد كده هما يعملولك Refer لعملا .. وازى تستخدم السوشيال ميديا لصالحك ولشغلك وكلام من ده .. طيب الجزء ده هيبقى ملخص اللى فاتت بطريقه عملية شوية تقدر تبدأ بيها يعنى نقدر نقول ان المقال ده اول مقال حقيقى عشان تبدأ فعلا فى شغل ال Freelancing ...
نبدأ وحاول تنفذ الخطوات دى كده بهدوء ومع نفسك وتبقى صريح مع نفسك جدا
1 - حلل قدراتك ومهاراتك كويس جدا جدا , يعنى ايه ؟ بمعنى انك تجيب ورقه وقلم كده وتكتب انت بتعرف تشتغل ف ايه وتقدر تقدم خدمات لعملائك ف انهى مجال يعنى مثلا تقول انا شغال فى المجال الفلانى واعرف اللغات كذا وكذا و تانى خليك صريح مع نفسك جدا .. عشان متظلمش نفسك وتظلم العملا بتوعك .. طبعا مش شرط تبقى محترف فى المجال بتاعك الاحتراف بيجى مع الشغل لكن ع الاقل تبقى فاهم كويس وتعرف تشتغل بأيدك كويس
2 - ال Portfolio بتاعك .. ركز ع الخطوة دى جدا .. شوف احسن شغل انت عملته فى المجال بتاعك ده ايه و اعرضه للناس فى كل مكان عن طريق ال Social Media او حتى Printed لو شغال فى الكتابة او حاجة Printable . المهم توصل الشغل ده لاكبر قدر من الناس مش كده وبس لا وتنقعهم بيه جدا .. اعرض شغلك ع الناس بإستمرار و بمعنى اخر "ابهرهم بيك" .. طيب لو مش عندى حاجة اعرضها للناس يبقى متفكرش فى شغل غير لما يبقى عندك حاجات كويسه توريها للناس
3- Research .. حاول تعمل بحث عن كل الناس اللى شغالين فى مجالك وشاطرين فيها شوف هما بدأوا ازاى فى المجال بتاعهم وايه اللغات او التقنيات اللى شغالين بيها غير كده شوف السوق محتاج ايه من المجال بتاعك برده زى ماقولتلك فى المقال اللى فاتت متشتغلش على حاجة فات اوانها خليك دايما متطلع على الجديد .. شوف اكتر مكان بيبقى فيه العملا بتوعك سواء ع النت او غير النت دور ع Twitter , Facebook , LinkedIn او Google .. اخر حاجة فى النقطه دى قيم ساعتك ووقتك كويس جدا وشوف ساعتك بتساوى اد ايه (كنت اتكلمت فى النقطه دى بالتفصيل فى الجزء الخامس)
4 - Your Resume .. اهتم بال Resume او ال CV بتاعك وخليه شكله كويس بحيث لما عميل يسألك عليه يبقى جاهز ممكن تستبدل ال CV التقليدى بأكونت محترم جدا على LinkedIn لان ده منبع ل Business كتير جدا
5- Tell Everyone about yourself .. لو كنت بتستخدم الFacebook كتير بدل ما تنشر حاجات ملهاش لازمه وبوستات مش مفيده انشر معلومات عن المجال بتاعك عرف الناس يعنى ايه المجال بتاعك بمعنى تانى علمهم حاجة وخليهم يثقوا فيك جدا .. عرف صحابك او حد من قرايبك او اى حد قريب منك .. من الاخر خلى كل الناس تعرف انت بتشتغل ايه .. عشان لو هما شافوا عميل عايز شغل فى المجال بتاعك يكلموك ويرشحوك للعميل ده بالاسم .. ف اهتم بالنقطه دى جدا
5 - Local Company . راسك شركاتك عن طريق موقعهم او ال Facebook Page بتاعتهم وعرف بشغلك بحيث برده لما يحتجولك يكلموك بس طبعا لازم تقدم نفسك بطريقة مميزة عن غيرك
6 - طول مانت بتدور على عملا , اتعلم ومتزهقش طور من مهاراتك وثقافتك فى المجال بتاعك دايما
7 - واخيرا وليس اخرا اعمل الخطوات دى وكررها وادعيلى

زى ماقولتلك فى اول المقال ده ممكن تلاقى الكلام متكرر بس ده مخلص اللى فات ونقطه البداية فعلا لكل واحد عايز يبدأ Freelancing .. اخر حاجة عايز اقولها فى المقال ان المقالات الجاية ان شاء الله هتبقى مختلفة عن الاجزاء اللى فاتت لان هتركز على الجزء العملى اكتر من النظرى .. اتمنى التوفيق لكل الناس والسلام عليكم ورحمه الله وبركاته
.............................................
.................................
[الجزء التامن من شرح الفرى لانسنج - هل انت Freelancer ناجح ؟]
السلام عليكم ورحمه الله وبركاته , الاجزاء اللى فاتت كنا اتكلمنا عن البداية فى ال Freelancing و ازاى تستعد لسوق العمل وتحدد سعر البروجكت والكلام ده , طيب النهارده المقال هيبقى فكرته مختلفة شوية وهى انى هعتبر انك طبقت الخطوات اللى ف الاجزاء وجالك شغل من عملا , ايوة مستغرب ليه ؟! .. بعد طبعا مايجيلك عملا , فى اعتبارات لازم تبقى ف دماغك دايما تحدد بيها هل انت ماشى فى الطريق الصح ولا لا ؟ , وهل فى حاجة ناقصه انك تنفذها عشان تبقى فى مستوى احسن ؟ .. طيب ايه هى الاعتبارات دى
1 - هل انت دخلت ال Freelancing عشان بتحبه ونفسك تعمل حاجة كويسة فى مجالك ولا مجرد سمعت الناس بتقول انه بيجيب فلوس ف اتجهت له , ولا مثلا حاولت فى شركات كتير واترفضت ف قررت تدخل ال Freelancing , اهم حاجة فى النقطه دى انك تبقى حابب مجال الشغل ومستعد تقضى فيه وقت طويل جدا تشتغل من غير زهق وحابب تعمل حاجة كويسة لنفسك وللناس .
2 - لما بتشتغل ف مشروع بتضطر تشتغل overtime فوق وقتك الاساسى ولا بتخلصه فى معاده لو بتضطر تشتغل وقت زيادة يبقى انت عندك مشكله فى تنظيم الوقت وبضيعك وقتك فى حاجات ملهاش علاقة بالشغل , ف لازم تعيد النظر فى ازاى وقتك بيضيع وحاول تحسن ادارتك للوقت
* حاول تستخدم برامج Time Track عشان تشوف انت وقتك بيروح ازاى وانت مش واخد بالك حاول تبحث عن نوعية البرامج اللى بتعمل Tracking لل Time .. ان شاء الله هتفيدك جدا
3 - لما بيجيلك مشروع بتاخد وقت راحة كتير وبتحاول تأجل المشروع ده بأى شكل طبعا عشان مفيش مدير ولا حاجة ولا بتعرف التزماتك كويس .. حاول تاخد المشروع وتبقى انت رقيب نفسك عشان تخل فى الوقت اللى انت متفق عليه مع العميل
4 - فلوسك اللى بتقضبها من الشغل هل بتصرفها كلها على احتياجاتك الشخصية ولا بتخلى جزء منها عشان تتعلم كورسات جديدة او تشترى كتب جديدة ؟ لازم تسأل نفسك السؤال ده لانك لو بتحب شغلك ومجالك فعلا ف لازم تدفع جزء من الفلوس دى عشان تزود مهاراتك وعشان يجيلك اضعاف الفلوس دى ان شاء الله
5 - بتعرف تنظم وقتك بين حياتك العملية وحياتك الشخصية ولالا ؟ لازم كل حاجة منهم تبقى منفصله عن التانية عشان ميحصلش مشاكل تأثير على حياتك او شغلك
6 - بتتكلم مع الناس كتير عن مجالك وعن انت بتعرف ايه ؟ ولا محدش يعرف عنك حاجة ؟ .. طبعا اهم حاجة فى ال Freelancing الاسم والسمعة ف عشان كده لازم تعرف الناس عن شغلك ومجالك وتوريهم شغلك اللى انت عملته .. عشان تبنى عندهم سمعة كويسة ليك بحيث لو هما شافوا حد محتاج حاجة فى المجال ده يكلموك مباشرة
7 - لازم تبقى عامل خطة لمستقبلك , بمعنى مثلا انت ناوى تفتح شركة خاصة بيك بعد كده ولا ناوى تعمل مشروع ولا ايه هدفك بعد كده ؟ لازم تبقى عامل حساب مستقبلك كويس

دى بعض النقط اللى لازم تاخد بالك منها وتسألها لنفسك كل شوية عشان تحدد انت ماشى فى الطريق الصح ولالا , يارب يكون المقال ده افادكم . واستنوا الاجزاء الجاية ان شاء الله
السلام عليكم ورحمة الله وبركاته
......................................
.
...........................................
[الجزء التاسع من شرح الفرى لانسنج- اهمية الFacebook لل Freelancers ]
السلام عليكم ورحمة الله وبركاته , الاجزاء اللى فاتت وصلنا فيها لحد ان انت المفروض لقيت عملا وشغال معاهم وعرفنا ازاى تحدد انت ماشى صح ولا غلط , طيب فى المقال ده هنتكلم عن حاجة مهمة جدا هو ان انت ازاى تنمى شغلك وتوصل لعدد اكبر من العملا وتسوق لنفسك صح , طيب كل ده ازاى ؟ عن طريق ال Facebook .. كلنا طبعا بنستخدم الفيس بوك سواء بنكلم صحابنا او قرايبنا او بنزل صور والكلام ده , طيب مانا ممكن استغل قعدتى دى بإنى اوصل لعملا اكتر واجيب شغل لنفسى (حاول تستغل كل حاجة انت بتعملها عشان تكبر شغلك) و ده بيكون عن طريق المشاركات والتعليقات مع الناس فى الGroups او ال Pages وغيرهم بمعنى انك لازم تبقى متابع اكبر واهم الصفحات فى مجالك حاول تشارك الناس وتنتقد لو انت مش موافق على رأي حد لان ده هيديك خبره اكتر وهتفهم حاجة مكنتش عارفها قبل كده وهيخلى الناس تحترم وجهه نظرك ويعرفوا مدى خبرتك فى مجالك . طيب ايه اللى يخلى الفيس بوك دور فعال فى انى الاقى شغل , ببساطه لان عليه عدد كبير جدا جدا من الناس مش معنى كده ان كل الناس هتهتم بشغلك وتتفاعل معاك لا , بس هتلاقى ناس كتير مهتمه تعرف عن شغلك اكتر .. طيب بعد مادخل ع الجروبات واتكلم مع الناس والحاجات دى اعمل ايه ؟ .. اعمل Page عشان تفصل بين الProfile اللى ممكن يكون عليه حد من قرايبك او صحابك اللى مش هيهتموا بالمجال بتاعك ولا الشغل ف هيبقى كلامك ساعتها محدش هيهتم بيه .. ف عشان كده اعمل Page لنفسك بس تخلى فيها افضل حاجة انت عملتها تنشر للناس معلومات جديدة كل شوية علمهم حاجة فى مجالك . بحيث تفيد وتستفيد , ده هيخليك Trusted عن ناس كتير وبالتالى سهل جدا يجيلك عملا وهما واثقين فى شغلك وحتى فى سعرك, ممكن ما يجلكش عملا بطريقه مباشرة بس عن طريق واحد صحبك يكون عارف شغلك وواثق فيه ف يرشحك لحد تانى .. بمعنى اصح حاول تستغل الصفحه دى فى اى حاجة تفيدك وتفيد الناس عشان تبقى مرجع ليهم فى مجالك ودى مش حاجة سهلة بس عايزة وقت ومجهود .. طيب ده كان بإختصار ازاى تستخدم الفيس بوك . الكلام ده ممكن يكون معروف عند ناس كتير بس الاهم من ده انك تطبقه .. اخر حاجة عيوب الفيس بوك اللى لازم تاخد بالك منها :
1 - وانت شغال بتتكلم مع حد فى معلومه معينه , تلاقى واحد صحبك كلمك يطلب منك حاجة او تلاقى خبر تقراه وهكذا , يعنى هتلاقى كذا حاجة بتشتت تركيزك بس انت خليك محدد وقت ليك ع الفيس بوك بحيث الوقت ميتسرقش منك وتلاقى نفسك ضيعت وقت كتيييير من غير اى لزمة
2- تاخد بالك انك لو قعدت تتكلم عن نفسك كتير وتشكر فى نفسك الناس مش هتتقبلك بالعكس هيحاولوا يبعدوا عنك , ف خد بالك من النقطه دى بالذات
3 - ممكن يكون مجالك مش محتاج الفيس بوك او بمعنى تانى ان العملا بتوعك مش مهتمين بالفيس بوك ساعتها هتضطر تقلل وقتك جدا على الفيس بوك وتشوف العملا بتوعك بيكون فين تواجدهم ع ال Social Media

طبعا الفيس بوك ممكن يكون له دور اساسى فى شغلك لو انت استخدمته صح واستغليت وقتك عليه بس اهم حاجة حدد الوقت بتاعك اللى هتستخدم فيه الفيس بوك عشان متضيعش وقت كتيير , يارب يكون المقال ده عجبكم وافادكم .. و انا موجود لأى اسئلة ان شاء الله
والسلام عليكم ورحمه الله وبركاته
 
........................................
 
 
 
 
 

ASP vs ASP.Net

http://www.codeproject.com/Articles/16703/Differences-between-ASP-NET-and-ASP

http://dev.fyicenter.com/Interview-Questions/dotNet-1/How_ASP_NET_different_from_ASP_.html


http://www.diffen.com/difference/ASP_vs_ASP.Net

Triggers -- SQL Server

Introduction

Triggers in SQL Server

Background

This article gives a brief introduction about Triggers in SQL Server 2000/2005.

What is a Trigger

A trigger is a special kind of a store procedure that executes in response to certain action on the table like insertion, deletion or updation of data. It is a database object which is bound to a table and is executed automatically. You can’t explicitly invoke triggers. The only way to do this is by performing the required action no the table that they are assigned to.

Types Of Triggers

There are three action query types that you use in SQL which are INSERT, UPDATE and DELETE. So, there are three types of triggers and hybrids that come from mixing and matching the events and timings that fire them. Basically, triggers are classified into two main types:
  1. After Triggers (For Triggers)
  2. Instead Of Triggers

(i) After Triggers

These triggers run after an insert, update or delete on a table. They are not supported for views.
AFTER TRIGGERS can be classified further into three types as:
  1. AFTER INSERT Trigger.
  2. AFTER UPDATE Trigger.
  3. AFTER DELETE Trigger.
Let’s create After triggers. First of all, let’s create a table and insert some sample data. Then, on this table, I will be attaching several triggers.
CREATE TABLE Employee_Test
(
Emp_ID INT Identity,
Emp_name Varchar(100),
Emp_Sal Decimal (10,2)
)

INSERT INTO Employee_Test VALUES ('Anees',1000);
INSERT INTO Employee_Test VALUES ('Rick',1200);
INSERT INTO Employee_Test VALUES ('John',1100);
INSERT INTO Employee_Test VALUES ('Stephen',1300);
INSERT INTO Employee_Test VALUES ('Maria',1400);
I will be creating an AFTER INSERT TRIGGER which will insert the rows inserted into the table into another audit table. The main purpose of this audit table is to record the changes in the main table. This can be thought of as a generic audit trigger.
Now, create the audit table as:-
CREATE TABLE Employee_Test_Audit
(
Emp_ID int,
Emp_name varchar(100),
Emp_Sal decimal (10,2),
Audit_Action varchar(100),
Audit_Timestamp datetime
)

(a) After Insert Trigger

This trigger is fired after an INSERT on the table. Let’s create the trigger as:
CREATE TRIGGER trgAfterInsert ON [dbo].[Employee_Test] 
FOR INSERT
AS
 declare @empid int;
 declare @empname varchar(100);
 declare @empsal decimal(10,2);
 declare @audit_action varchar(100);

 select @empid=i.Emp_ID from inserted i; 
 select @empname=i.Emp_Name from inserted i; 
 select @empsal=i.Emp_Sal from inserted i; 
 set @audit_action='Inserted Record -- After Insert Trigger.';

 insert into Employee_Test_Audit
           (Emp_ID,Emp_Name,Emp_Sal,Audit_Action,Audit_Timestamp) 
 values(@empid,@empname,@empsal,@audit_action,getdate());

 PRINT 'AFTER INSERT trigger fired.'
GO
The CREATE TRIGGER statement is used to create the trigger. THE ON clause specifies the table name on which the trigger is to be attached. The FOR INSERT specifies that this is an AFTER INSERT trigger. In place of FOR INSERT, AFTER INSERT can be used. Both of them mean the same.
In the trigger body, table named inserted has been used. This table is a logical table and contains the row that has been inserted. I have selected the fields from the logical inserted table from the row that has been inserted into different variables, and finally inserted those values into the Audit table.
To see the newly created trigger in action, lets insert a row into the main table as:
 insert into Employee_Test values('Chris',1500);
Now, a record has been inserted into the Employee_Test table. The AFTER INSERT trigger attached to this table has inserted the record into the Employee_Test_Audit as:
6   Chris  1500.00   Inserted Record -- After Insert Trigger. 2008-04-26 12:00:55.700

(b) AFTER UPDATE Trigger

This trigger is fired after an update on the table. Let’s create the trigger as:
CREATE TRIGGER trgAfterUpdate ON [dbo].[Employee_Test] 
FOR UPDATE
AS
 declare @empid int;
 declare @empname varchar(100);
 declare @empsal decimal(10,2);
 declare @audit_action varchar(100);

 select @empid=i.Emp_ID from inserted i; 
 select @empname=i.Emp_Name from inserted i; 
 select @empsal=i.Emp_Sal from inserted i; 
 
 if update(Emp_Name)
  set @audit_action='Updated Record -- After Update Trigger.';
 if update(Emp_Sal)
  set @audit_action='Updated Record -- After Update Trigger.';

 insert into Employee_Test_Audit(Emp_ID,Emp_Name,Emp_Sal,Audit_Action,Audit_Timestamp) 
 values(@empid,@empname,@empsal,@audit_action,getdate());

 PRINT 'AFTER UPDATE Trigger fired.'
GO
The AFTER UPDATE Trigger is created in which the updated record is inserted into the audit table. There is no logical table updated like the logical table inserted. We can obtain the updated value of a field from the update(column_name) function. In our trigger, we have used, if update(Emp_Name) to check if the column Emp_Name has been updated. We have similarly checked the column Emp_Sal for an update.
Let’s update a record column and see what happens.
 update Employee_Test set Emp_Sal=1550 where Emp_ID=6
This inserts the row into the audit table as:
6  Chris  1550.00  Updated Record -- After Update Trigger.   2008-04-26 12:38:11.843

(c) AFTER DELETE Trigger

This trigger is fired after a delete on the table. Let’s create the trigger as:
CREATE TRIGGER trgAfterDelete ON [dbo].[Employee_Test] 
AFTER DELETE
AS
 declare @empid int;
 declare @empname varchar(100);
 declare @empsal decimal(10,2);
 declare @audit_action varchar(100);

 select @empid=d.Emp_ID from deleted d; 
 select @empname=d.Emp_Name from deleted d; 
 select @empsal=d.Emp_Sal from deleted d; 
 set @audit_action='Deleted -- After Delete Trigger.';

 insert into Employee_Test_Audit
(Emp_ID,Emp_Name,Emp_Sal,Audit_Action,Audit_Timestamp) 
 values(@empid,@empname,@empsal,@audit_action,getdate());

 PRINT 'AFTER DELETE TRIGGER fired.'
GO
In this trigger, the deleted record’s data is picked from the logical deleted table and inserted into the audit table. Let’s fire a delete on the main table. A record has been inserted into the audit table as:
 6  Chris 1550.00  Deleted -- After Delete Trigger.  2008-04-26 12:52:13.867
All the triggers can be enabled/disabled on the table using the statement
ALTER TABLE Employee_Test {ENABLE|DISBALE} TRIGGER ALL
Specific Triggers can be enabled or disabled as:
ALTER TABLE Employee_Test DISABLE TRIGGER trgAfterDelete
This disables the After Delete Trigger named trgAfterDelete on the specified table.

(ii) Instead Of Triggers

These can be used as an interceptor for anything that anyone tried to do on our table or view. If you define an Instead Of trigger on a table for the Delete operation, they try to delete rows, and they will not actually get deleted (unless you issue another delete instruction from within the trigger)
INSTEAD OF TRIGGERS can be classified further into three types as:
  1. INSTEAD OF INSERT Trigger.
  2. INSTEAD OF UPDATE Trigger.
  3. INSTEAD OF DELETE Trigger.
Let’s create an Instead Of Delete Trigger as:
CREATE TRIGGER trgInsteadOfDelete ON [dbo].[Employee_Test] 
INSTEAD OF DELETE
AS
 declare @emp_id int;
 declare @emp_name varchar(100);
 declare @emp_sal int;
 
 select @emp_id=d.Emp_ID from deleted d;
 select @emp_name=d.Emp_Name from deleted d;
 select @emp_sal=d.Emp_Sal from deleted d;

 BEGIN
  if(@emp_sal>1200)
  begin
   RAISERROR('Cannot delete where salary > 1200',16,1);
   ROLLBACK;
  end
  else
  begin
   delete from Employee_Test where Emp_ID=@emp_id;
   COMMIT;
   insert into Employee_Test_Audit(Emp_ID,Emp_Name,Emp_Sal,Audit_Action,Audit_Timestamp)
   values(@emp_id,@emp_name,@emp_sal,'Deleted -- Instead Of Delete Trigger.',getdate());
   PRINT 'Record Deleted -- Instead Of Delete Trigger.'
  end
 END
GO
This trigger will prevent the deletion of records from the table where Emp_Sal > 1200. If such a record is deleted, the Instead Of Trigger will rollback the transaction, otherwise the transaction will be committed. Now, let’s try to delete a record with the Emp_Sal >1200 as:
delete from Employee_Test where Emp_ID=4
This will print an error message as defined in the RAISE ERROR statement as:
Server: Msg 50000, Level 16, State 1, Procedure trgInsteadOfDelete, Line 15
Cannot delete where salary > 1200
And this record will not be deleted.
In a similar way, you can code Instead of Insert and Instead Of Update triggers on your tables.

Conclusion

In this article, I took a brief introduction of triggers, explained the various kinds of triggers – After Triggers and Instead Of Triggers along with their variants and explained how each of them works. I hope you will get a clear understanding about the Triggers in SQL Server and their usage.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
..........................................
ref.http://www.codeproject.com/Articles/25600/Triggers-SQL-Server

Sunday, February 16, 2014

How is meant by DLL ? AND . Which DLL translate XML to SQL in IIS?

Sqlisapi.dll


link of dll
http://myfixbase.com/windows_dll/14786.html

How is meant by DLL ?
A DLL (Dynamic Link Library) is a file that can be loaded and executed by programs dynamically. Basically it’s an external code repository for programs. Since usually several different programs reuse the same DLL instead of having that code in their own file, this dramatically reduces required storage space. A synonym for a DLL would be library.

Saturday, February 15, 2014

What is CLR?


http://dev.fyicenter.com/Interview-Questions/dotNet-1/What_is_CLR_.htmlAnswer 1:
CLR(Common Language Runtime) is the main resource of .Net Framework. it is collection of services like garbage collector, exception handler, jit compilers etc. with the CLR cross language integration is possible.

Answer 2:
The .NET Framework provides a runtime environment which runs the code and provides services that make the development process easier. This runtime environment in .NET Framework is known as Common Language Runtime (CLR). The CLR sits at the very heart of managed code. Common Language Runtime is the generalized multi-language, reflective execution engine on which code originally written in various languages runs. At a higher level, CLR is simply an engine that takes in Intermediate Language (IL) instructions, translates them into machine instructions, and executes them. Although the common language runtime provides many standard runtime services, managed code is never interpreted. A feature called just-in-time (JIT) compiling enables all managed code to run in the native machine language of the system on which it is executing. The CLR shares much in common with a traditional operating system.

Quote:
Managed code is the term used for any code that is running on .NET Framework.

The CLR provides the infrastructure that enables managed code to execute as well provides variety of services during execution. When a method, for which IL has been generated, is called for the first time the CLR compiles the IL into native code that is specific to the processor the Environment it is running on (This process is known as Just in Time Compilation or JIT). If the same method is called next time, the existing JIT compiled code is reused. During execution managed code receives variety of services from the runtime environment.

Quote:
When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. Intermediate Language is a binary assembly language that is compiled at runtime down to whatever machine language is appropriate for the host CPU. This runtime compilation is called Just-In-Time Compiling or JIT-compiling.

Advantages of Managed Execution Environments
In unmanaged environments the compiler and linker directly compile the source code in to native instructions that are targeted at a specific processor. The disadvantage of this process is that each time you want to run your executable on a different platform you will have to re-compile the code using a compiler and linker that will compile the code that is targeted at the specific hardware. This means that each time you want your application to run on a different platform, you will have to ship the compiled instructions again and again. As this leads to compiling and maintaining multiple versions of the same application, the companies try to create a more generalized compiled version in order to target most of the environments. This process is known as the Lowest Common Denominator approach. This leads to a more generalized program which is not optimized properly and does not take advantages of the underlying hardware infrastructure (processor, cache, etc). Because the CLR supplies one or more Just in Time Compiler for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture. This

CLR provides the following benefits for developers:
Vastly simplified development.
Seamless integration of code written in various languages.
Evidence-based security with code identity.
Assembly-based deployment that eliminates DLL Hell.
Side-by-side versioning of reusable components.
Code reuse through implementation inheritance.
Automatic object lifetime management.
Code access security.
Cross Language Integration.
Self describing objects.

The CLR automatically handles object layout and manages references to objects, releasing them when they are no longer being used. This automatic memory management resolves the two most common application errors, memory leaks and invalid memory references. This process is known as Garbage Collection. The CLR also manages thread execution, code execution, code safety verification, compilation, and other system services.

The CLR is designed for the software of the future, and it also supports software of today and yesterday. Interoperability between managed and unmanaged code provided by CLR helps developers continue to use necessary COM components and DLLs.

What is IIS? Have you used it? Short Note ..

IIS - Internet Information Server
IIS is used to access the ASP.Net web applications
Yes, I used in ASP.NET web applications.

Monday, February 10, 2014

Difference between ADO and ADO.net Technology

Difference between ADO and ADO.net Technology

Difference between ADO and ADO.net
1. ADO used connected data usage, while ADO.net used disconnected data environment.
2. ADO used OLE DB to access data and is COM-based, while ADO.net uses XML as the format for transmitting data to and from your database and web application.
3. In ADO, Record set, is like a single table or query result, while in ADO.net Dataset, can contain multiple tables from any data source.
4. In ADO, it is sometime problematic because firewall prohibits many types of request, while in ADO.net there is no such problem because XML is completely firewall-proof.
................................................................................................

17. What is the difference between ADO and ADO.NET?
ADO uses Recordsets and cursors to access and modify data. Because of its inherent design, Recordset can impact performance on the server side by tying up valuable resources. In addition, COM marshalling - an expensive data conversion process - is needed to transmit a Recordset. ADO.NET addresses three important needs that ADO doesn't address:

1. Providing a comprehensive disconnected data-access model, which is crucial to the Web environment
2. Providing tight integration with XML, and
3. Providing seamless integration with the .NET Framework (e.g., compatibility with the base class library's type system). From an ADO.NET implementation perspective, the Recordset object in ADO is eliminated in the .NET architecture. In its place, ADO.NET has several dedicated objects led by the DataSet object and including the DataAdapter, and DataReader objects to perform specific tasks. In addition, ADO.NET DataSets operate in disconnected state whereas the ADO RecordSet objects operated in a fully connected state.

In ADO, the in-memory representation of data is the recordset. In ADO.NET, it is the dataset. A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table. In contrast, a dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database.

In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method. In ADO.NET, rows are represented as collections, so you can loop through a table as you would through any collection, or access particular rows via ordinal or primary key index. A cursor is a database element that controls record navigation, the ability to update data, and the visibility of changes made to the database by other users. ADO.NET does not have an inherent cursor object, but instead includes data classes that provide the functionality of a traditional cursor. For example, the functionality of a forward-only, read-only cursor is available in the ADO.NET DataReader object.

There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source.
.................................................................
ref
http://dotnetguts.blogspot.com/2007/07/difference-between-ado-and-adonet.html

http://dev.fyicenter.com/Interview-Questions/dotNet-1/What_is_the_difference_between_ADO_and_ADO_NET_.html

Thursday, February 6, 2014

ADO.NET Interview Questions: Part 1

Table of contents

Introduction

In this section, we will touch base on one of the important concepts in .NET database access. You can download my .NET interview questions PDF from http://www.questpond.com/SampleDotNetInterviewQuestionBook.zip. I have also put all the Design Patterns text in video format and uploaded it at http://www.questpond.com/FreeDesign1.htm. You can visit http://www.questpond.com and download the complete architecture interview questions PDF which covers SOA, UML, Design Patterns, Togaf, OOPs etc.
You can download the software architecture interview questions PDF here: Download Software Architecture Interview Questions.
Previous parts of my interview questions series for architects:
UML interview questions Part 1: SoftArch5.aspx
Happy job hunting......

(B) What is the namespace in which .NET has the data functionality class?

Following are the namespaces provided by .NET for data management:

System.Data

This contains the basic objects used for accessing and storing relational data, such as DataSet, DataTable, and DataRelation. Each of these is independent of the type of data source and the way we connect to it.

System.Data.OleDB

It contains the objects that we use to connect to a data source via an OLE-DB provider, such as OleDbConnection, OleDbCommand, etc. These objects inherit from the common base classes, and so have the same properties, methods, and events as the SqlClient equivalents.

System.Data.SqlClient

This contains the objects that we use to connect to a data source via the Tabular Data Stream (TDS) interface of Microsoft SQL Server (only). This can generally provide better performance as it removes some of the intermediate layers required by an OLE-DB connection.

System.XML

This contains the basic objects required to create, read, store, write, and manipulate XML documents according to W3C recommendations.

(B) Can you give an overview of the ADO.NET architecture?

The most important concept in ADO.NET architecture is “Data Provider”. Data Provider provides access to data sources (SQL Server, Access, Oracle). In short, it provides an object to achieve functionalities like opening and closing connection, retrieve data, and update data. In the below figure, you can see the four main sections of a data provider:
  • Connection.
  • Command object (this is the object for using Stored Procedures).
  • Data Adapter (this object acts as a bridge between the data store and the dataset).
  • Data Reader (this object reads data from the data store in forward only mode).
  • DataSet object represents disconnected and cached data. If you see the diagram, it is not in direct connection with the data store (SQL Server, Oracle, etc.) rather it talks with the data adapter, who is responsible for filling the dataset. The dataset can have one or more datatables and relations.

  • Figure: 9.1 ADO.NET architecture
  • The DataView object is used to sort and filter data in the datatable.
Note: This is one of the poular questions in .NET interviews. Just paste the picture in your mind and during the interview try to refer to the image.

(B) What are the two fundamental objects in ADO.NET?

DataReader and DataSet are the two fundamental objects in ADO.NET.

(B) What is the difference between DataSet and DataReader?

Following are some major differences between DataSet and DataReader:
  • DataReader provides forward-only and read-only access to data, while the DataSet object can hold more than one table (in other words, more than one row set) from the same data source as well as the relationships between them.
  • DataSet is a disconnected architecture while DataReader is a connected architecture.
  • DataSet can persist contents while DataReader cannot persist contents, they are forward only.

(I) What are the major difference between classic ADO and ADO.NET?

Following are some major differences:
  • In ADO, we have a Recordset and in ADO.NET we have a DataSet.
  • In Recordset, we can only have one table. If we want to accommodate more than one table, we need to do inner join and fill the Recordset. A DataSet can have multiple tables.
  • All data is persisted in XML as compared to classic ADO where data is persisted in binary format.

(B) What is the use of the Connection object?

They are used to connect data to a Command object.
  • An OleDbConnection object is used with an OLE-DB provider.
  • A SqlConnection object uses Tabular Data Services (TDS) with MS SQL Server.

(B) What is the use of Command objects?

They are used to connect a Connection object to a DataReader or DataSet. Following are the methods provided by a Command object:
  • ExecuteNonQuery
  • Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE, or INSERT). Returns an Integer indicating the number of rows affected by the query.
  • ExecuteReader
  • Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting row set within the database, allowing the rows to be retrieved.
  • ExecuteScalar
  • Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only a single value (effectively the first column of the first row of the resulting row set, any other returned columns and rows are discarded). It is fast and efficient when only a "singleton" value is required.

(B) What is the use of a data adapter?

These objects connect one or more Command objects to a DataSet object. They provide logic that would get data from the data store and populates the tables in the DataSet, or pushes the changes in the DataSet back into the data store.
  • An OleDbDataAdapter object is used with an OLE-DB provider
  • A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.

(B) What are basic methods of a DataAdapter?

These are the most commonly used methods of a DataAdapter:
  • Fill
  • Executes the Select command to fill the DataSet object with data from the data source. It an also be used to update (refresh) an existing table in a DataSet with changes made to the data in the original data source if there is a primary key in the table in the DataSet.
  • FillSchema
  • Uses the SelectCommand to extract just the schema for a table from the data source, and creates an empty table in the DataSet object with all the corresponding constraints.
  • Update
  • Calls the respective InsertCommand, UpdateCommand, or DeleteCommand for each inserted, updated, or deleted row in the DataSet so as to update the original data source with the changes made to the content of the DataSet. This is a little like the UpdateBatch method provided by the ADO Recordset object, but in the DataSet, it can be used to update more than one table.

(B) What is a DataSet object?

The DataSet provides the basis for disconnected storage and manipulation of relational data. We fill it from a data store, work with it while disconnected from that data store, then reconnect and flush changes back to the data store if required.

(B) What are the various objects in a DataSet?

DataSet has a collection of DataTable objects within the Tables collection. Each DataTable object contains a collection of DataRow objects and a collection of DataColumn objects. There are also collections for primary keys, constraints, and default values used in this table, which is called as constraint collection, and the parent and child relationships between the tables. Finally, there is a DefaultView object for each table. This is used to create a DataView object based on the table, so that the data can be searched, filtered, or otherwise manipulated while displaying the data.
Note: Look back again to the main diagram for the ADO.NET architecture for visualizing this answer in pictorial form.

(B) How can we connect to Microsoft Access, FoxPro, and Oracle etc.?

Microsoft provides the System.Data.OleDb namespace to communicate with databases like Access, Oracle, etc. In short, any OLE DB-compliant database can be connected using the System.Data.OldDb namespace.
Note: A small sample of OLEDB is provided in WindowsAppOleDb which uses Nwind.mdb in the bin directory to display data in a listbox.
Private Sub loadData() 
    Dim strPath As String
    strPath = AppDomain.CurrentDomain.BaseDirectory
    Dim objOLEDBCon As New OleDbConnection(“Provider=Microsoft.Jet." & _ 
        "OLEDB.4.0;Data Source =” & strPath & “Nwind.mdb”)
    Dim objOLEDBCommand As OleDbCommand
    Dim objOLEDBReader As OleDbDataReader
    Try 
        objOLEDBCommand = New OleDbCommand(“Select FirstName from Employees”)
        objOLEDBCon.Open()
        objOLEDBCommand.Connection = objOLEDBCon
        objOLEDBReader = objOLEDBCommand.ExecuteReader()
        Do While objOLEDBReader.Read()
            lstNorthwinds.Items.Add(objOLEDBReader.GetString(0))
        Loop
    Catch ex As Exception
    Throw ex
    Finally
        objOLEDBCon.Close()
    End Try
End Sub
The main code is in the LoadData method which actually loads the data in the list box.
Note: This source code has the connectionstring hard coded in the program itself which is not a good programming practice. For Windows applications, the best place to store the connectionstring is “App.config”. Also note that the AppDomain.CurrentDomain.BaseDirectory function gives the current path of the running exe which is “BIN” and the MDB file is in that directory. Also note, the Finally block executes irrespective of if there is an error or not. This ensures that all the connections to the datastore are freed. It is a best practice to put all clean up statements in a Finally block thus ensuring that the resources are deallocated properly.

(B) How do we connect to SQL Server, which namespace do we use?

Below is the code required. We will try to understand the code in a more detailed manner. For this sample, we will also need a SQL table setup, which I have imported, using the DTS wizard.
Private Sub LoadData()
    ' note :- with and end with makes your code more readable
    Dim strConnectionString As String
    Dim objConnection As New SqlConnection
    Dim objCommand As New SqlCommand
    Dim objReader As SqlDataReader
    Try
    ' this gets the connectionstring from the app.config file.
    ' note if this gives error see where the MDB file is stored
    ' in your pc and point to thastrConnectionString = AppSettings.Item(“ConnectionString”)
    ' take the connectiostring and initialize the connection object
    With objConnection
        .ConnectionString = strConnectionString
        .Open()
    End With
    objCommand = New SqlCommand(“Select FirstName from Employees”)
    With objCommand
        .Connection = objConnection
        objReader = .ExecuteReader()
    End With
    ' looping through the reader to fill the list box
    Do While objReader.Read()
        lstData.Items.Add(objReader.Item(“FirstName”))
    Loop
    Catch ex As Exception
        Throw ex
    Finally
    objConnection.Close()
End Try
<appSettings>
    <add key=”Connectionstring” value=”Server=ERMBOM1-IT2;User ID=sa;Database=Employees”/>
</appSettings>
Note: The above code is provided in CD in the folder WindowsAppSqlClient. Comments in the code explain a lot but we will iterate through the code later. LoadData is the main method which loads the data from SQL Server. Before running this code, you have to install SQL Server in your machine. As we are dealing with SQLClient, we need to setup a database in SQL Server. For this sample, I have imported Nwind.mdb in the “SampleAccessDatabase” folder in CD into SQL Server. Depending on the computer you will have to change the connectionstring in the Web.config file.
For setting up the sample SQL table, we can use the DTS import wizard to import the table. See the below figure which uses Microsoft Access as the data source. While importing the database, give the database name as “Employees”.

Figure: 9.2 Loading “Nwind.mdb” in SQL SERVER for the sample

Figure: 9.3 Load only the Employee table.
To make it simple, we will only import the employee table as that is the only thing needed in our sample code.

Figure: 9.4 View of loaded Employee table
Now from interview point of view, definitely you are not going to say the whole source code which is given in the book. The interviewer expects a broader answer of the steps needed to connect to SQL Server. You only have to explain the LoadData method in a broader way. Following are the steps to connect to SQL Server:
  • First imports the namespace “System.Data.SqlClient”.
  • Create a connection object as shown in the LoadData method.
  • With objConnection
        .Connection String = strConnectionString
        .Open ()
    End With
  • Create the command object with the SQL. Also, assign the created connection object to the command object and execute the reader.
  • ObjCommand = New SqlCommand (“Select First Name from Employees”)
    
    With objCommand
        .Connection = objConnection
        Breeder = .Execute Reader ()
    End With
  • Finally loop through the reader and fill the list box. If VB programmers are expecting the move next command, it has been replaced by Read() which returns True if there is any data to be read. If Read() returns False that means that it’s the end of the data reader and there is no more data to be read.
  • Do while objReader.Read ()
        lstData.Items.Add (objReader.Item (“First Name”))
    Loop
  • Do not forget to close the connection object.
  • Note: In LoadData, you will see that the connectionstring is stored in the Web.config file and is loaded using AppSettings.Item(“ConnectionString”). While running this sample live on your database, do not forget to change this connectionstring according to your machine name and SQL Server or else the source code will not run.

    ........................................
    Ref.Shivprasad koirala  ..http://www.questpond.com/...http://www.codeproject.com