Click here to Skip to main content
15,893,508 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow do I exit a loop early Pin
AAGTHosting5-Mar-08 14:09
AAGTHosting5-Mar-08 14:09 
AnswerRe: How do I exit a loop early Pin
Christian Graus5-Mar-08 14:12
protectorChristian Graus5-Mar-08 14:12 
GeneralRe: How do I exit a loop early Pin
AAGTHosting5-Mar-08 14:26
AAGTHosting5-Mar-08 14:26 
GeneralRe: How do I exit a loop early Pin
Christian Graus5-Mar-08 16:47
protectorChristian Graus5-Mar-08 16:47 
AnswerRe: How do I exit a loop early Pin
Nilesh Hapse5-Mar-08 18:29
Nilesh Hapse5-Mar-08 18:29 
GeneralDisplay table relations in datagridview Pin
regedit5-Mar-08 7:27
regedit5-Mar-08 7:27 
QuestionChallenging Crystal Reports / .NET Windows application question Pin
KreativeKai5-Mar-08 6:19
professionalKreativeKai5-Mar-08 6:19 
AnswerRe: Challenging Crystal Reports / .NET Windows application question [modified] Pin
KreativeKai5-Mar-08 8:17
professionalKreativeKai5-Mar-08 8:17 
I've been searching for the solution on the web and found a few different suggestions which I combined and came up with the answer to my question.

Here is the code:

Public Declare Auto Function SQLConfigDataSource Lib "ODBCCP32.DLL" _<br />
    (ByVal hwndParent As Integer, ByVal fRequest As Integer, _<br />
     ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer<br />
<br />
Private Const ODBC_ADD_SYS_DSN As Integer = 4<br />
 <br />
<br />
Private Sub Create_DSN_For_Crystal_Reports()<br />
  Try<br />
    Dim attributes As New System.Text.StringBuilder()<br />
    Dim returnCode As Integer<br />
<br />
    attributes.Append("DSN=MyCrystalDSN")<br />
    attributes.Append(Chr(0))<br />
    attributes.Append("Server=MyDBServer")<br />
    attributes.Append(Chr(0))<br />
    attributes.Append("Description=DSN added via code from My VB App")<br />
    attributes.Append(Chr(0))<br />
    attributes.Append("Database=MyDatabase")<br />
    attributes.Append(Chr(0))<br />
    attributes.Append("AnsiNPW=Yes")<br />
    attributes.Append(Chr(0))<br />
    attributes.Append("QuotedId=Yes")<br />
    attributes.Append(Chr(0))<br />
    attributes.Append("Trusted_Connection=Yes")<br />
    attributes.Append(Chr(0))<br />
    attributes.Append(Chr(0))<br />
<br />
    returnCode = SQLConfigDataSource(0&, ODBC_ADD_SYS_DSN, "SQL Server", attributes.ToString)<br />
<br />
    If returnCode <> 1 Then<br />
       Throw New Exception("DSN could not be setup to allow Crystal Reports access")<br />
    End If<br />
  Catch ex as Exception<br />
    msgbox(ex.message)<br />
  End Try<br />
End Sub


Hopefully posting the answer will help someone else later who has the same problem. Big Grin | :-D

Lost in the vast sea of .NET

modified on Thursday, March 6, 2008 8:45 AM

GeneralRe: Challenging Crystal Reports / .NET Windows application question Pin
codemunch5-Mar-08 9:28
codemunch5-Mar-08 9:28 
GeneralRe: Challenging Crystal Reports / .NET Windows application question Pin
KreativeKai6-Mar-08 2:45
professionalKreativeKai6-Mar-08 2:45 
GeneralRe: Challenging Crystal Reports / .NET Windows application question Pin
codemunch6-Mar-08 8:44
codemunch6-Mar-08 8:44 
GeneralReading all data from port 80 Pin
stikiweb5-Mar-08 5:43
stikiweb5-Mar-08 5:43 
QuestionReport.Sections.Add gets an error, why? Pin
soporificeffect5-Mar-08 2:03
soporificeffect5-Mar-08 2:03 
GeneralTransparencykey not working Pin
Ahmad Zaidi5-Mar-08 1:12
Ahmad Zaidi5-Mar-08 1:12 
GeneralRe: Transparencykey not working Pin
Xmen Real 5-Mar-08 2:28
professional Xmen Real 5-Mar-08 2:28 
QuestionHow to copy files in a folder tree into a single folder Pin
Krishnaraj Barvathaya B5-Mar-08 0:51
Krishnaraj Barvathaya B5-Mar-08 0:51 
AnswerDuplicate Post. Ignore It! Pin
Vasudevan Deepak Kumar5-Mar-08 0:57
Vasudevan Deepak Kumar5-Mar-08 0:57 
QuestionSQL Timeout Pin
Zacharia John4-Mar-08 23:51
Zacharia John4-Mar-08 23:51 
GeneralRe: SQL Timeout Pin
Vasudevan Deepak Kumar5-Mar-08 1:05
Vasudevan Deepak Kumar5-Mar-08 1:05 
QuestionWebBrowser Control: Suppressing File Download Dialog Pin
Mbire4-Mar-08 23:18
Mbire4-Mar-08 23:18 
GeneralRe: WebBrowser Control: Suppressing File Download Dialog Pin
Vasudevan Deepak Kumar5-Mar-08 1:04
Vasudevan Deepak Kumar5-Mar-08 1:04 
GeneralRe: WebBrowser Control: Suppressing File Download Dialog Pin
Mbire5-Mar-08 1:19
Mbire5-Mar-08 1:19 
QuestionFileSystem searching and error handling Pin
The One4-Mar-08 23:15
The One4-Mar-08 23:15 
AnswerRe: FileSystem searching and error handling Pin
mschol24-May-08 6:27
mschol24-May-08 6:27 
QuestionHelp creating a xml file using xsd file Pin
SpikeUK4-Mar-08 23:12
SpikeUK4-Mar-08 23:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.