<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating ADODB Connection in VB</title>
	<atom:link href="http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/</link>
	<description>Bringing geekiness to the world</description>
	<lastBuildDate>Sun, 22 Jan 2012 19:50:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: SEPoii</title>
		<link>http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/comment-page-1/#comment-784</link>
		<dc:creator>SEPoii</dc:creator>
		<pubDate>Mon, 20 Sep 2010 12:36:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/#comment-784</guid>
		<description>Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public mysqlport, myusername, mypassword, mydatabasename, serverhost As String


Public Sub main()
Open App.path &amp; &quot;/connection.urs&quot; For Input As #1
Input #1, serverhost
Input #1, mydatabasename
Input #1, myusername
Input #1, mypassword
Input #1, mysqlport
Close #1

cn.ConnectionString = &quot;Driver={MySQL ODBC 5.1 Driver};Server=&quot;&amp;serverhost&amp;&quot;;Port=&quot;&amp;mysqlport&amp;&quot;;Database=&quot;&amp;mydatabasename&amp;&quot;;Password=&quot;&amp;mypassword&amp;&quot;;Option=3;&quot;
cn.Open
Debug.Print &quot;Connection Object Created&quot;

    If cn.State = adStateClosed Then
    MsgBox &quot;unable to connect to database&quot;, vbCritical
    Exit Sub
    End If
cn.CursorLocation = adUseClient
endsub
End Sub

Public Function openrecordset(YourQuery As String)
If rs.State = 0 Then rs.Open YourQuery, cn, adOpenDynamic, adLockBatchOptimistic
End If
End Function

Public Function closerecordset()
If rs.State = 1 Then rs.Close
End Function
Public Function ConnectionDetails(Server As String, DatabaseName As String, Username As String, Password As String, Port As Integer)
Open App.path &amp; &quot;/connection.urs&quot; For Output As #1
Print #1, Server
Print #1, DatabaseName
Print #1, Username
Print #1, Password
Print #1, Port
Close #1
End Function</description>
		<content:encoded><![CDATA[<p>Public cn As New ADODB.Connection<br />
Public rs As New ADODB.Recordset<br />
Public mysqlport, myusername, mypassword, mydatabasename, serverhost As String</p>
<p>Public Sub main()<br />
Open App.path &amp; &#8220;/connection.urs&#8221; For Input As #1<br />
Input #1, serverhost<br />
Input #1, mydatabasename<br />
Input #1, myusername<br />
Input #1, mypassword<br />
Input #1, mysqlport<br />
Close #1</p>
<p>cn.ConnectionString = &#8220;Driver={MySQL ODBC 5.1 Driver};Server=&#8221;&amp;serverhost&amp;&#8221;;Port=&#8221;&amp;mysqlport&amp;&#8221;;Database=&#8221;&amp;mydatabasename&amp;&#8221;;Password=&#8221;&amp;mypassword&amp;&#8221;;Option=3;&#8221;<br />
cn.Open<br />
Debug.Print &#8220;Connection Object Created&#8221;</p>
<p>    If cn.State = adStateClosed Then<br />
    MsgBox &#8220;unable to connect to database&#8221;, vbCritical<br />
    Exit Sub<br />
    End If<br />
cn.CursorLocation = adUseClient<br />
endsub<br />
End Sub</p>
<p>Public Function openrecordset(YourQuery As String)<br />
If rs.State = 0 Then rs.Open YourQuery, cn, adOpenDynamic, adLockBatchOptimistic<br />
End If<br />
End Function</p>
<p>Public Function closerecordset()<br />
If rs.State = 1 Then rs.Close<br />
End Function<br />
Public Function ConnectionDetails(Server As String, DatabaseName As String, Username As String, Password As String, Port As Integer)<br />
Open App.path &amp; &#8220;/connection.urs&#8221; For Output As #1<br />
Print #1, Server<br />
Print #1, DatabaseName<br />
Print #1, Username<br />
Print #1, Password<br />
Print #1, Port<br />
Close #1<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pcnorb</title>
		<link>http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/comment-page-1/#comment-411</link>
		<dc:creator>pcnorb</dc:creator>
		<pubDate>Fri, 12 Jun 2009 19:05:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/#comment-411</guid>
		<description>Excellent examples. Gave me the push I needed for querying a MSIDXS data source for sorting OCR&#039;d tif documents.

Which reminds me; anyone know of a source for good comparisons of the MODI iFilter compared to the likes of iFilterShop or Captaris?

TIA!

John Croson
www.croson.us
pcnorb.homelinux.org
ihbsonline.com</description>
		<content:encoded><![CDATA[<p>Excellent examples. Gave me the push I needed for querying a MSIDXS data source for sorting OCR&#8217;d tif documents.</p>
<p>Which reminds me; anyone know of a source for good comparisons of the MODI iFilter compared to the likes of iFilterShop or Captaris?</p>
<p>TIA!</p>
<p>John Croson<br />
<a  href="http://www.croson.us" rel="nofollow">http://www.croson.us</a><br />
pcnorb.homelinux.org<br />
ihbsonline.com</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sanusiemmanuel</title>
		<link>http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/comment-page-1/#comment-392</link>
		<dc:creator>sanusiemmanuel</dc:creator>
		<pubDate>Thu, 14 May 2009 11:01:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/#comment-392</guid>
		<description>Pls, how do i connect to MySQL Database,ODBC , oracle and access 2007</description>
		<content:encoded><![CDATA[<p>Pls, how do i connect to MySQL Database,ODBC , oracle and access 2007</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guru</title>
		<link>http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/comment-page-1/#comment-208</link>
		<dc:creator>Guru</dc:creator>
		<pubDate>Sat, 18 Oct 2008 17:03:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/#comment-208</guid>
		<description>Ideally, you would use rstable.addnew

Then, it is logical to push all the data from our input form to the recordset and update it so as the data gets stored in our database. Let me show you how to do it.

#1
rstable(0)=txtsomething.text

&quot;(0)&quot; represents the column it is referring to. &quot;0&quot; is the index. It starts from 0 to number of fields in database minus 1 (n-1).

Lets say we have got 5 fields, so it will start from 0 to 4

#2
We can also use the below method which i prefer.

rstable(&quot;fieldname&quot;)=txtsomething.text

This is more meaningful. We can understand what is going on and our code becomes more readable.

The last step for adding new record is rstable.update

Now we are done with adding new record.

Deleting a record is simple. Use any method (record navigation, search or filter) for going to a record, then on your delete button (that is what i use normally), use rstable.delete

That&#039;s it
Note: I have not tried the codes in my comment right now. It was some time back. So test it and let me know. And btw, the codes in the tut work well. :)</description>
		<content:encoded><![CDATA[<p>Ideally, you would use rstable.addnew</p>
<p>Then, it is logical to push all the data from our input form to the recordset and update it so as the data gets stored in our database. Let me show you how to do it.</p>
<p>#1<br />
rstable(0)=txtsomething.text</p>
<p>&#8220;(0)&#8221; represents the column it is referring to. &#8220;0&#8243; is the index. It starts from 0 to number of fields in database minus 1 (n-1).</p>
<p>Lets say we have got 5 fields, so it will start from 0 to 4</p>
<p>#2<br />
We can also use the below method which i prefer.</p>
<p>rstable(&#8220;fieldname&#8221;)=txtsomething.text</p>
<p>This is more meaningful. We can understand what is going on and our code becomes more readable.</p>
<p>The last step for adding new record is rstable.update</p>
<p>Now we are done with adding new record.</p>
<p>Deleting a record is simple. Use any method (record navigation, search or filter) for going to a record, then on your delete button (that is what i use normally), use rstable.delete</p>
<p>That&#8217;s it<br />
Note: I have not tried the codes in my comment right now. It was some time back. So test it and let me know. And btw, the codes in the tut work well. <img src='http://www.geekscribes.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Swetha</title>
		<link>http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/comment-page-1/#comment-207</link>
		<dc:creator>Swetha</dc:creator>
		<pubDate>Fri, 17 Oct 2008 05:28:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.geekscribes.net/blog/2008/04/23/creating-adodb-connection-in-vb/#comment-207</guid>
		<description>Hi, I read through the coding. Till now i was using the ADODC to get the connections done. Using this coding snippet if the connections are done then later to add or delete from the recordset what would be the coding that i need to use. Please help. 
Thanks in advance</description>
		<content:encoded><![CDATA[<p>Hi, I read through the coding. Till now i was using the ADODC to get the connections done. Using this coding snippet if the connections are done then later to add or delete from the recordset what would be the coding that i need to use. Please help.<br />
Thanks in advance</p>
]]></content:encoded>
	</item>
</channel>
</rss>

