DSN behind the button click event http://forums.asp.net/t/1771623.aspx/1?DSN+behind+the+button+click+event+Wed, 22 Feb 2012 23:53:27 -050017716234841208http://forums.asp.net/p/1771623/4841208.aspx/1?DSN+behind+the+button+click+event+DSN behind the button click event <p>Hello,</p> <p></p> <p>I am trying to connect to Sybase using the odbcConnection and want to put the code in the vb file behind the button click event to retrieve the row of data and put it in the text boxes on the form.&nbsp; I am getting an error on line below. Do I have to use the console to display the data with the datareader or is there a better way.&nbsp; Thank you in advance if anyone can suggest. The actual error is below.</p> <p>&nbsp; Dim con As New OdbcConnection()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con = New OdbcConnection(&quot;DSN=;Uid=;Pwd=&quot;)<br> <br> <br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim sql As String = &quot;SELECT dbo.Pat.firstName, dbo.Pat.middleName, dbo.Pat.lastName, dbo.Pat.sexCd, dbo.Pat.SSN, dbo.Pat.birthDt, dbo.ExtPat.MRNum&quot; &amp; _<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;FROM dbo.ExtPat, dbo.Pat WHERE dbo.ExtPat.PID = dbo.Pat.PID AND (dbo.ExtPat.MRNum = '001839995')&quot;<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim myCommand As New OdbcCommand(sql, con)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.Open()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong> Dim myReader As OdbcDataReader = myCommand.ExecuteReader()</strong><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do While myReader.Read()<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Loop</p> <h2><i>ERROR [42000] [DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]Incorrect syntax near '.'.</i></h2> 2012-02-20T12:48:53-05:004843966http://forums.asp.net/p/1771623/4843966.aspx/1?Re+DSN+behind+the+button+click+event+Re: DSN behind the button click event <p></p> <blockquote><span class="icon-blockquote"></span> <h4>sbuggle</h4> ERROR [42000] [DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]Incorrect syntax near '.'.</blockquote> <p></p> <p>Hello</p> <p>This error means that your syntax is wrongand I strongly suggest you trying to put the sql string into the running timesomething like the SQL Managetment Studio in your Sydatabaseto check whether the sql is wrong or notSo the problem can be solved</p> 2012-02-22T00:20:29-05:004845366http://forums.asp.net/p/1771623/4845366.aspx/1?Re+DSN+behind+the+button+click+event+Re: DSN behind the button click event <p>This is Sybase and it works so could it be with the odbc drivers?&nbsp; </p> <p></p> 2012-02-22T13:51:04-05:004846019http://forums.asp.net/p/1771623/4846019.aspx/1?Re+DSN+behind+the+button+click+event+Re: DSN behind the button click event <p></p> <blockquote><span class="icon-blockquote"></span> <h4>sbuggle</h4> <p></p> <p>This is Sybase and it works so could it be with the odbc drivers?&nbsp;</p> <p></p> </blockquote> <p></p> <p>Not very surebut I still suggest you downloading the .NET DataBase for ADO.NET providor for that specific database<a href="http://www.datadirect.com/products/net/net-for-sybase/index.html">http://www.datadirect.com/products/net/net-for-sybase/index.html</a></p> 2012-02-22T23:53:27-05:00