<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:s="http://www.techrepublic.com/search" xmlns:dc="http://purl.org/dc/elements/1.1/"  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
    <title><![CDATA[Questions & Answers: SQL Statement in VB6 Code ]]></title>
    <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code]]></link>
    <atom:link rel="hub" type="application/rss+xml" href="http://pubsubhubbub.appspot.com/" />
    <atom:link rel="self" type="application/rss+xml" href="http://www.techrepublic.com/forum/questions/101-227484/rss" />

    <description><![CDATA[]]></description>
    <language>en-us</language>
    <lastBuildDate>2013-05-21T13:20:14-07:00</lastBuildDate>
             

    <item>
        <title><![CDATA[You need a where clause]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2309372]]></link>
        <description><![CDATA[Select * from tablename will return all records in the table.&quot;Select * from Tablename WHERE myfield = mycriteria&quot; will return only records which match.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2309372]]></guid>
        <dc:creator><![CDATA[rob@...]]></dc:creator>
        <pubDate>Tue, 28 Aug 2007 06:05:02 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[VB Query]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2308700]]></link>
        <description><![CDATA[hi,got a problem about creating reports in VB.i no the 'select * from tablename;'but i want to display details of only one record. what should be the syntax??please post a reply because i'm totally bloked]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2308700]]></guid>
        <dc:creator><![CDATA[saheer85@...]]></dc:creator>
        <pubDate>Mon, 27 Aug 2007 08:31:11 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Deprecated]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2266167]]></link>
        <description><![CDATA[The style of join syntax simonlarsen is referring to has in fact been deprecated in favor of join syntax. That being said, no DBMS I'm aware of has discontinued support for the old syntax and although the new join syntax promises increase efficiency and speed, this primarily applies to very large data sets. Additionally, the old syntax is more human readable.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2266167]]></guid>
        <dc:creator><![CDATA[kerry.millen@...]]></dc:creator>
        <pubDate>Tue, 26 Jun 2007 15:00:31 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Check how strSuit is used]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2266162]]></link>
        <description><![CDATA[Dim strSuit As StringstrSuit = cboPayCombo.Text&quot;SELECT tblInfo.fldSuit, tblInfo.fldRCR, tblPayments.fldPDate, tblPayments.fldPaid, tblPayments.fldBalance, tblPayments.fldCashier, tblPayments.fldRecNum, tblPayments.fldVchNum, tblPayments.fldSuit FROM tblInfo, tblPayments WHEREtblInfo.fldSuit=tblPayments.fldSuit ANDtblPayments.fldSuit = '&quot; &amp; strSuit &amp; &quot;'&quot;The last part of your WHERE clause is doing this:tblPayments.fldSuit = 'strSuit'&quot;Since strSuit is not a literal string but a string variable, shouldn't you be doing this?tblPayments.fldSuit=strSuit&quot;]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2266162]]></guid>
        <dc:creator><![CDATA[kerry.millen@...]]></dc:creator>
        <pubDate>Tue, 26 Jun 2007 14:53:54 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Is this against SQL Server?]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265559]]></link>
        <description><![CDATA[If not ignore my post.If it is you are approaching this so wrong it is not funny.For starters that style of join syntax is deprecated.Secondly take advantage of the performance sql has rather than messing about with ad hoc statements.Thirdly don't create strings, security nightmare.try this.From query analyser or SSMS (depending on version).create proc pr_sWhatever @strSuit varchar (8000) = Nullasset nocount onSELECT i.fldSuit, i.fldRCR, p.fldPDate, p.fldPaid, p.fldBalance, p.fldCashier, p.fldRecNum, p.fldVchNum, p.fldSuit From tblInfo i join tblPayments  pon i.fldSuit = p.fldSuit Where p.fldSuit = @strSuitgoI have put a varchar 8000, check what you actually need there.then your string isstrQuery = &quot;pr_sWhatever &quot; &amp; strSuitexcept of course this is not ado style code.You probably want to create an ado command object and declare the parameter and set it.bam! performance and security all in one quick hit.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265559]]></guid>
        <dc:creator><![CDATA[simonmlarsen@...]]></dc:creator>
        <pubDate>Tue, 26 Jun 2007 04:03:21 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Another trick for debugging queries]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265533]]></link>
        <description><![CDATA[When you get done building the query string, display it (or put a breakpoint in and copy it's contents) and check it.  It's not only easier to spot problems with quotation marks (unbalanced, missing, mismatched) but you can also paste the string into your favorite query client and &quot;play&quot; with it there until you have the correct query, then go back to make the fixes in your code.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265533]]></guid>
        <dc:creator><![CDATA[navanax@...]]></dc:creator>
        <pubDate>Tue, 26 Jun 2007 03:52:01 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[SQL Statement (INNER JOIN)]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265477]]></link>
        <description><![CDATA[Assuming the link between the two tables tblInfo and tblPayments is fldSuit, you have to use this field to join the two tables on the FROM clause as:From tblInfo inner join tblPayments on  tblInfo.fldSuit = tblPayments.fldSuitIt's only that I am not sure what error message you are getting but try this.Hope it helps.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265477]]></guid>
        <dc:creator><![CDATA[hlanai]]></dc:creator>
        <pubDate>Tue, 26 Jun 2007 02:37:43 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Types mismatch, I suppose]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265458]]></link>
        <description><![CDATA[1. What data type of tblPayments.fldSuit is?2. Try strSuit = cboPayCombo.Valuehttp://www.sql-ex.ru/]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265458]]></guid>
        <dc:creator><![CDATA[msi77@...]]></dc:creator>
        <pubDate>Tue, 26 Jun 2007 02:04:54 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[Try an explicit join]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265478]]></link>
        <description><![CDATA[i.e.:From tblInfo INNER JOIN tblPayments ON tblInfo.fldSuit=tblPayments.fldSuit WHERE tblPayments.fldSuit = '&quot; &amp; strSuit &amp; &quot;'&quot;]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2265478]]></guid>
        <dc:creator><![CDATA[rob@...]]></dc:creator>
        <pubDate>Tue, 26 Jun 2007 01:55:51 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[How To Diagnose]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2264955]]></link>
        <description><![CDATA[Strip your SQL statement down to something that works and add pieces back until it fails.  This will allow you to diagnose the problem.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2264955]]></guid>
        <dc:creator><![CDATA[Wayne M.]]></dc:creator>
        <pubDate>Mon, 25 Jun 2007 10:35:01 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[count your apostrophes]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2264781]]></link>
        <description><![CDATA[I suspect it is actually the WHERE clause that is wrong.]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2264781]]></guid>
        <dc:creator><![CDATA[john.a.wills@...]]></dc:creator>
        <pubDate>Mon, 25 Jun 2007 08:35:12 -0700</pubDate>
    </item>
             

    <item>
        <title><![CDATA[SQL Statement in VB6 Code]]></title>
        <link><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2264664]]></link>
        <description><![CDATA[I thank all of you for your input. Unfortunately no suggestion workes.I have created a query using VB6 Query builder which works when run from the Query builder but when placed in my code it produce the following error.&quot;syntax erroe in FROM CLAUSE&quot;Here is the Select statement which works in the Query builder.SELECT tblInfo.fldSuit, tblPayments.fldSuit, tblInfo.fldRCR, tblPayments.fldPDate, tblPayments.fldPaid, tblPayments.fldBalance, tblPayments.fldCashier, tblPayments.fldRecNum, tblPayments.fldVchNumFROM tblInfo INNER JOIN tblPayments ON tblInfo.fldSuit = tblPayments.fldSuitWHERE tblPayments.fldSuit =  Gsuit;I know that the problem is in declairing &quot;GSuit&quot; as a string in the select statement. The syntax to do this is where I am falling down.?To fill the Grid with data that matches the Value in cboPayCombo    Dim strSuit As StringstrSuit = cboPayCombo.TextstrQuery = &quot;SELECT tblInfo.fldSuit, tblPayments.fldSuit, tblInfo.fldRCR, tblPayments.fldPDate, tblPayments.fldPaid, tblPayments.fldBalance, tblPayments.fldCashier, tblPayments.fldRecNum, tblPayments.fldVchNumFROM tblInfo INNER JOIN tblPayments ON tblInfo.fldSuit = tblPayments.fldSuitWHERE tblPayments.fldSuit =  Gsuit&quot;adoGrid.RecordSource = strQuery   adoGrid.RefreshdtgPayment.ReBindPlease if someone can show me the correct syntax I would be very happy. Thank you.You can contact me direct at belcredit@yahoo.com]]></description>
        <guid><![CDATA[http://www.techrepublic.com/forum/questions/101-227484/sql-statement-in-vb6-code?#msg-2264664]]></guid>
        <dc:creator><![CDATA[belcredit@...]]></dc:creator>
        <pubDate>Mon, 25 Jun 2007 07:26:52 -0700</pubDate>
    </item>
    </channel>
</rss>

