i have prolem can you help me - Mailing list pgsql-sql
From | saytinh |
---|---|
Subject | i have prolem can you help me |
Date | |
Msg-id | 10009763.post@talk.nabble.com Whole thread Raw |
List | pgsql-sql |
-- 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), CONSTRAINTenforce_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 Where1=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.