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

C#

 
GeneralRe: IDispose Pin
netJP12L2-Sep-08 4:42
netJP12L2-Sep-08 4:42 
AnswerRe: IDispose Pin
Scott Dorman2-Sep-08 9:54
professionalScott Dorman2-Sep-08 9:54 
Questionhow to retreive publickey from the xml document Pin
prasadbuddhika1-Sep-08 18:32
prasadbuddhika1-Sep-08 18:32 
QuestionUpdate DataTable with DataGridView Pin
myNameIsRon1-Sep-08 17:59
myNameIsRon1-Sep-08 17:59 
AnswerRe: Update DataTable with DataGridView Pin
AhsanS1-Sep-08 18:03
AhsanS1-Sep-08 18:03 
GeneralRe: Update DataTable with DataGridView Pin
myNameIsRon1-Sep-08 18:53
myNameIsRon1-Sep-08 18:53 
QuestionShortcut keys in msvisio Pin
tahir_makhdoom1-Sep-08 17:23
tahir_makhdoom1-Sep-08 17:23 
Ranti do it like the linq. Pin
ioriliao1-Sep-08 16:31
ioriliao1-Sep-08 16:31 
using System;
using System.Reflection;
namespace SqlSentence
{ 
    public static class SqlString
    {
        public static string SELECT(this string This, params string[] columnName)
        {
            string s=" SELECT ";
            for (int i = 0; i < columnName.Length; i++)
            {
                s += columnName[i] + ",";
            }
            return This + s.Substring(0, s.Length - 1);
        }

        public static string FROM(this string This, string tableName)
        {
            return This + " FROM " + tableName;
        }

        public static string AS(this string This, string target)
        {
            return This + " AS " + target;
        }

        public static string WHERE(this string This, string term)
        {
            return This + " WHERE " + term;
        }

        public static string EQUAL(this string This, string value)
        {
            return This + " = " + value;
        }

        public static string EQUAL(this string This)
        {
            return This + " = ";
        }

        public static string PARAMETERS(this string This, string value)
        {
            return This + "@" + value;
        }

        public static string AND(this string This, string where)
        {
            return This + " AND " + where;
        }
    }
}


using System;
using System.Windows.Forms;
using System.Data.SqlClient;
using SqlSentence;
//using System.Collections.Generic;

namespace WindowsFormsApplication4
{

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = cmd.CommandText.SELECT("Name", 
                                     "sex".AS("Sex") , "ID").   
                                     FROM("customer").WHERE("name".EQUAL 
                                     ("'zhangshan'").AND("sex".EQUAL
                                     ("'boy'")));
            SqlCommand otherCmd = new SqlCommand();
            otherCmd.CommandText = otherCmd.CommandText.
                                            SELECT("name", 
                                            "sex".AS("Sex"), 
                                            "ID").
                                            FROM("customer").
                                            WHERE("name".EQUAL
                                            ("'zhangshan'").AND
                                            ("name".EQUAL().
                                            PARAMETERS("value")));
        }
    }
} 

GeneralRe: i do it like the linq. Pin
PIEBALDconsult1-Sep-08 17:54
mvePIEBALDconsult1-Sep-08 17:54 
GeneralRe: i do it like the linq. Pin
ioriliao1-Sep-08 20:01
ioriliao1-Sep-08 20:01 
GeneralRe: i do it like the linq. Pin
leppie1-Sep-08 21:19
leppie1-Sep-08 21:19 
GeneralRe: i do it like the linq. Pin
Guffa2-Sep-08 0:57
Guffa2-Sep-08 0:57 
QuestionSelect a treeNode in a treeView Pin
Kim06181-Sep-08 16:31
Kim06181-Sep-08 16:31 
AnswerRe: Select a treeNode in a treeView Pin
Laji591-Sep-08 21:39
Laji591-Sep-08 21:39 
GeneralRe: Select a treeNode in a treeView Pin
Kim06181-Sep-08 23:56
Kim06181-Sep-08 23:56 
GeneralRe: Select a treeNode in a treeView Pin
Laji592-Sep-08 1:18
Laji592-Sep-08 1:18 
GeneralRe: Select a treeNode in a treeView Pin
Kim06182-Sep-08 4:05
Kim06182-Sep-08 4:05 
Questioncan i such do it Pin
ioriliao1-Sep-08 16:02
ioriliao1-Sep-08 16:02 
AnswerRe: can i such do it Pin
N a v a n e e t h1-Sep-08 17:40
N a v a n e e t h1-Sep-08 17:40 
QuestionGet max value of primary key before doing insert into database Pin
xdavidx1-Sep-08 11:51
xdavidx1-Sep-08 11:51 
AnswerRe: Get max value of primary key before doing insert into database Pin
Colin Angus Mackay1-Sep-08 11:59
Colin Angus Mackay1-Sep-08 11:59 
GeneralRe: Get max value of primary key before doing insert into database Pin
xdavidx1-Sep-08 12:57
xdavidx1-Sep-08 12:57 
AnswerRe: Get max value of primary key before doing insert into database Pin
Guffa1-Sep-08 14:12
Guffa1-Sep-08 14:12 
AnswerRe: Get max value of primary key before doing insert into database Pin
Paul Conrad1-Sep-08 12:46
professionalPaul Conrad1-Sep-08 12:46 
AnswerRe: Get max value of primary key before doing insert into database Pin
PIEBALDconsult1-Sep-08 13:38
mvePIEBALDconsult1-Sep-08 13:38 

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.