Need help postgre with visual basic

Need help postgre with visual basic

am 08.03.2006 16:32:29 von dodol garut

--0-1321162812-1141831949=:9853
Content-Type: multipart/alternative; boundary="0-1498736715-1141831949=:9853"

--0-1498736715-1141831949=:9853
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

I try to build a simple visual basic project with PostgreSQL. Here i att=
ach that project.
That project still have problem and i need someone please to solve that=
problem.
For query is in supermarket.sql
Thanx before
=20
best regards,
ERIS RISO
Indonesia

Send instant messages to your online friends http://uk.messenger.yahoo.co=
m=20
--0-1498736715-1141831949=:9853
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

I try to build a simple  visual basic project with Postgre=
SQL. Here i attach that project.
That project still have prob=
lem and i need someone please to solve that problem.
For quer=
y is in supermarket.sql
Thanx before
 
=
best regards,
ERIS RISO
Indonesia

=
Send instant messages to your online friends http://uk.messenger.yahoo.co=
m=20
--0-1498736715-1141831949=:9853--

--0-1321162812-1141831949=:9853
Content-Type: application/x-zip-compressed; name="vb&POSTGRES.zip"
Content-Transfer-Encoding: base64
Content-Description: 867381367-vb&POSTGRES.zip
Content-Disposition: attachment; filename="vb&POSTGRES.zip"

UEsDBBQAAgAIAOetaDTl6Mj7EAEAAAECAAAcAAAAdmImUE9TVEdSRVMvc3Vw
ZXJtYXJrZXQxLnNxbIWOS2vCQBSF90L+wyWbRJhCtLhyFSW0Yi2ShorLq96m
acabMA8h/74TE0soLe7mcb7vnKMiNAQnNHhATaBtTeqMqiQz90bH7tf9SYIP
LI1VIVfdAS6ojp+owkk0Bq4MsJUStulqE6d7WCd7YXLZR52exr99NfGXRYns
lFZZA1fbbCCrVeGmNFBSI8rqRLWqTra85cRfS8QBucESCjbCPeWo0Vjk9t4O
WKZJnCWQxYuXBHpdOFAvn+MU/t0AjGfsk+9x2oUfXSkMq1av2XgO3qhgTcq0
zdWt6oLSkg6D7fohmgQi2BTXsU+VIs4DMZ1FUbvyDjl15IIU6kA44A7ht8TM
F/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MS5zcWxQSwEC
FAAUAAIACABmrmg0Vr3VMHcCAACEBQAAFQAAAAAAAAABACAAAABKAQAAdmIm
UE9TVEdSRVMvdXRhbWEuZnJtUEsBAhQAFAACAAgAjK5oNLWwmccQCAAAOScA
ABkAAAAAAAAAAQAgAAAA9AMAAHZiJlBPU1RHUkVTL2ZybXByb2R1ay5mcm1Q
SwECFAAUAAIACACMrmg0bxAVZpcDAAA4BwAAGwAAAAAAAAABACAAAAA7DAAA
dmImUE9TVEdSRVMvc3VwZXJtYXJrZXQudmJwUEsBAhQAFAACAAgAk65oNIAW
9ZFOAAAAZwAAABsAAAAAAAAAAQAgAAAACxAAAHZiJlBPU1RHUkVTL3N1cGVy
bWFya2V0LnZid1BLBQYAAAAABQAFAGYBAACSEAAAAAA=

--0-1321162812-1141831949=:9853
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

--0-1321162812-1141831949=:9853--

Re: Need help postgre with visual basic

am 08.03.2006 21:19:33 von Greg Campbell

This is a multi-part message in MIME format.
--------------050208090308010902040507
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi dodol garut.
Your applicaton looks nearly workable.

Recommendations:
1. Use care when sending code that contains a connection string with password.
2. Use pgAdmin to build your database creation scripts.
3. Use VB help, particulary MSDN to nail down syntax of ADO commands.
4. Name your global supermarkt ADO Connection object something like gcnnSupermarket intead of
dbSupermarket. Almost all connection objects are named "cnn"-something or "conn"-something. The "g" is
just an indication or a variable that is global to your applicaiton.
5. Test your connection string in isolation, to see if that works.
6. Rather than applying adUseClient to the connection object apply it to each recordset
(e.g. rs.CursorLocation = adUseClient)
7. Do NOT use adDynamic for a cursor type parameter, (unless you REALLY REALLY mean to).
8. Eliminate statements that do nothing (e.g. ExecuteSQL = AffectedRecords).
ExecuteSQL was supposed to be an function, but that function is not in your code, and it would be on the
other side of the equals sign.
9. Once you get the select and insert to work, explore PostgreSQL functions. They act like stored
procedures. Syntax is like "SELECT insert_produk(kodeproduk,namaproduk,hargasatuan)". See PostgreSQL docs
on how to build functions (return type void). pgAdmin again makes this pretty easy. pgAdmin is your friend.

expected code:
Sub cmdSave()

on error goto err_sub

'change to a single-ton select to guarantee the return on only one record, as long as the table exists
StrSQL1 = "select count(*) as kode_count from produk where kodeproduk='" & Text1.Text & "'"

Set rsValid = New ADODB.Recordset
rsCursorLocation = adUseClient 'put the client cursor location here, just to be sure

'for a read only 1 record query use adForwardOnly and adLockReadOnly
rsValid.Open StrSQL1, utama.gcnnSupermarket, adOpenForwardOnly, adlockReadOnly, adCmdText

If (rsValid("kode_count") = 0) Then
StrSql2 = "insert into produk(kodeproduk,namaproduk,hargasatuan) values('" & _
Text1.Text & "','" & _Text2.Text & "'," & Text3.Text & ")"

'better yet use a Stored Procedure for faster execution and to move db syntax/logic to database
'StrSql2 = "SELECT insert_produk('" & Text1.Text & "','" & _Text2.Text & "'," & Text3.Text & ")"

utama.gnnSupermarket.Execute StrSql2 [, AffectedCount, adCmdText] 'don't really need stuff in
brackets
.
.
.

Else
...
End If

set rsValid = Nothing
exit Sub

err_sub:
'err handling, msg boxes, etc.

End sub



dodol garut wrote:
> I try to build a simple visual basic project with PostgreSQL. Here i attach that project.
> That project still have problem and i need someone please to solve that problem.
> For query is in supermarket.sql
> Thanx before
>
> best regards,
> ERIS RISO
> Indonesia
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
>
>
> ------------------------------------------------------------ ------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

--------------050208090308010902040507
Content-Type: text/x-vcard; charset=utf-8;
name="greg.campbell.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="greg.campbell.vcf"

begin:vcard
fn:Greg Campbell
n:Campbell;Greg
org:Michelin North America - US5 Lexington;ENG-ASE
email;internet:greg.campbell@us.michelin.com
title:ASE Systems Engineer
tel;work:803-951-5561/x75561
x-mozilla-html:FALSE
version:2.1
end:vcard


--------------050208090308010902040507
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

--------------050208090308010902040507--