pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: saytinh <lovestory19852001@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: i have prolem can you help me
Date: Sun, 15 Apr 2007 20:48:25 -0700 (PDT)
Message-ID: <10009763.post@talk.nabble.com> (raw)


-- Table: ticket

-- DROP TABLE ticket;

CREATE TABLE ticket
(
  gid serial NOT NULL,
  id integer,
  name character varying,
  address character varying(254),
  province character varying(100),
  fax character varying(50),
  code integer,
  "type" integer,
  phone character varying(15),
  web character varying(40),
  levels integer,
  the_geom geometry,
  email character varying,
  CONSTRAINT ticket_pkey PRIMARY KEY (gid),
  CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'POINT'::text OR the_geom IS NULL),
  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 42102)
) 
WITHOUT OIDS;
ALTER TABLE ticket OWNER TO postgres;


Why i run void -> Exception parameter


       public DataTable SearchTicket(string strProvin, string strDistric,
string strName, string strAddress, string strPhone, string strFax, string
strEmail, string strType)
        {
            try
            {
                String Query = "Select name,gid from ticket Where 1=1 ";
                string str, str1;
                string strCode = "-1";
                if (strDistric != "" && strDistric != "0")
                {
                    Query += " and code = :code";
                    strCode = strDistric;
                }
                else
                {
                    if (int.Parse(strProvin) != 0)
                    {
                        Query += " and code like ':code%'";
                        strCode = strProvin;
                    }

                }
                if (int.Parse(strType) == 0)
                {
                    str = " like '%";
                    str1 = "%'";
                }
                else
                {
                    str = " = '";
                    str1 = "'";
                }
                if (strName != "")
                    Query += " and lower(name) " + str + ":name" + str1;
                if (strAddress != "")
                    Query += " and lower(address) " + str + ":address" +
str1;
                if (strPhone != "")
                    Query += " and lower(phone) " + str + ":phone" + str1;
                if (strFax != "")
                    Query += " and lower(fax) " + str + ":fax" + str1;
                if (strEmail != "")
                    Query += " and lower(email) " + str + ":email" + str1;
                Query += ";";

                NpgsqlParameter[] values = new NpgsqlParameter[6];
                values[0] = new NpgsqlParameter(@":code",
Convert.ToInt32(strCode));
                values[1] = new NpgsqlParameter(@":name",
strName.ToLower());
                values[2] = new NpgsqlParameter(@":address",
strAddress.ToLower());
                values[3] = new NpgsqlParameter(@":phone",
strPhone.ToLower());
                values[4] = new NpgsqlParameter(@":fax", strFax.ToLower());
                values[5] = new NpgsqlParameter(@":email",
strEmail.ToLower());

                values[0].Direction = ParameterDirection.Input;
                values[1].Direction = ParameterDirection.Input;
                values[2].Direction = ParameterDirection.Input;
                values[3].Direction = ParameterDirection.Input;
                values[4].Direction = ParameterDirection.Input;
                values[5].Direction = ParameterDirection.Input;

                values[0].SourceColumn = "code";
                values[1].SourceColumn = "name";

                DataSet ds = PostGresServerDataAccess.getDataFromSQL(Query,
"ticket", values);
                return ds.Tables["ticket"];
            }
            catch (Exception ex)
            {
                throw ex;
            }
 }
-- 
View this message in context: http://www.nabble.com/i-have-prolem-can-you-help-me-tf3582184.html#a10009763
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.




Message-ID: <10009763.post@talk.nabble.com>
Permalink:  ../10009763.post@talk.nabble.com/
Also on:    postgresql.org/message-id/10009763.post@talk.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lovestory19852001@yahoo.com
  Subject: Re: i have prolem can you help me
  In-Reply-To: <10009763.post@talk.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox