Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with SQL Connection String or Something

Status
Not open for further replies.

JuanjoZun

Programmer
Jul 20, 2002
82
MX
Hello Again. I'm working in ASP, hope you can help me with this question

I have a problem pulling data from a database... I have the table 'regent' and a field fecha that has 'dd/mm/yyyy' format (I guess). when I try to make a query from this table, the Date (fecha) come in 'mm/dd/yyyy' format. Here is short explanation of my page. I tried to use Session.LCID.


<% @LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot; %>
<% Session.LCID = 2058 %>

<% fecha_Ini = Request.form(&quot;ex4&quot;)
fecha_fin = Request.Form(&quot;ex5&quot;)
f_ini = formatdatetime (cdate(fecha_ini),2) 'dd/mm/yyyy format
f_fin = formatdatetime (cdate(fecha_fin),2)

set conn=Server.CreateObject(&quot;ADODB.Connection&quot;)

constr = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\ & &quot;;Persist Security Info=False&quot;

conn.Open constr
Response.Write &quot;LCID DB: &quot; & conn.Properties(&quot;Locale Identifier&quot;) & &quot; LCID Page: &quot; & session.LCID
'LCID from DB is 1034 session is 2058

set rs_f=Server.CreateObject(&quot;ADODB.recordset&quot;)
sqltxt_f = &quot;SELECT regent.fecha as fec &quot;_
& &quot;FROM regent RIGHT JOIN d_gen ON regent.cod = d_gen.cod &quot;_
& &quot;GROUP BY regent.fecha &quot;_
& &quot;HAVING (((regent.fecha) between #&quot; & f_ini & &quot;# And #&quot; & f_fin & &quot;#))&quot;

Response.Write sqltxt_f & &quot;<br>&quot;
rs_f.Open sqltxt_f, conn,1,2
'Here, takes i.e. f_ini=05/05/2003 (May 5,2003)
'f_fin=08/05/2003 (May 8, 2003)....
'And It takes: May 5, 2003 and Aug 5, 2003


Is there a way to Format the Date from SQL sentence, or conn.open?
Follow the dark side, so you can reach the light. [/color}


Follow the dark side, so you can reach the light. [/color}
 
Formatting dates is usually done at the presentation layer in an application, not at the database layer.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top