Click here to Skip to main content
16,017,707 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Using a C++ dll in VB.net Pin
Christian Graus2-May-05 14:54
protectorChristian Graus2-May-05 14:54 
GeneralRe: Using a C++ dll in VB.net Pin
Reanalyse3-May-05 14:37
Reanalyse3-May-05 14:37 
GeneralRe: Using a C++ dll in VB.net Pin
Christian Graus3-May-05 14:48
protectorChristian Graus3-May-05 14:48 
GeneralRe: Using a C++ dll in VB.net Pin
Reanalyse3-May-05 16:01
Reanalyse3-May-05 16:01 
GeneralRe: Using a C++ dll in VB.net Pin
Christian Graus3-May-05 16:11
protectorChristian Graus3-May-05 16:11 
GeneralApp config help Pin
Joey Picerno2-May-05 10:23
Joey Picerno2-May-05 10:23 
GeneralRe: App config help Pin
mike2k52-May-05 11:58
mike2k52-May-05 11:58 
GeneralRe: App config help Pin
Joey Picerno2-May-05 12:51
Joey Picerno2-May-05 12:51 
I created my connections with code also but what i am trying to figure out is why my code is not reading the connection string from the app.config file like it should. Here is some of my code.... Remember i have written an app config file and i am trying to get the code to read the connection string so when i install it on other machines i can just change the connection string in the config file. Some stuff i have 'ed , just disreguard those lines of code, they are the ones i was using before i started to work with the app.config.

this is my app config code:


<configuration>
<appsettings>
<add key="connstring" value="workstation id=JOEYP;packet size=4096;integrated security=SSPI;data source=JOEYP;persist security info=False;initial catalog=Tithe Master">
<add key="conn" value="workstation id=JOEYP;packet size=4096;integrated security=SSPI;data source=JOEYP;persist security info=False;initial catalog=Tithe Master">



HERE IS MY VB CODE:

Imports System.Configuration
...
Sub LoadData()
ListView1.Items.Clear()
'Dim conn As New SqlClient.SqlConnection("workstation id=JOEYP;packet size=4096;integrated security=SSPI;data source=JOEYP;persist security info=False;initial catalog=Tithe Master")
'Dim conn As New SqlClient.SqlConnection(conn1)
Dim Conn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("conn"))


Try
Conn.Open()
Dim adapter As New SqlClient.SqlDataAdapter
Dim cmd As New SqlClient.SqlCommand("SELECT * FROM tblTithes", conn)
adapter.SelectCommand = cmd
Dim reader As SqlClient.SqlDataReader
reader = adapter.SelectCommand.ExecuteReader
Dim itm As ListViewItem
While reader.Read
itm = New ListViewItem(Format(reader("ServiceDate").ToString, "Short Date"))
itm.SubItems.Add(reader("MemberID").ToString)
itm.SubItems.Add(reader("Tithes").ToString)
itm.SubItems.Add(reader("Missions").ToString)
itm.SubItems.Add(reader("Harvest").ToString)
itm.SubItems.Add(reader("Special").ToString)
itm.SubItems.Add(reader("Other").ToString)
itm.SubItems.Add(reader("Total").ToString)

ListView1.Items.Add(itm)
End While
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Dispose()
End Sub
GeneralRe: App config help Pin
Het21092-May-05 18:43
Het21092-May-05 18:43 
GeneralKilling child processes Pin
Sam Marrocco2-May-05 8:29
Sam Marrocco2-May-05 8:29 
GeneralGet variables set in a SUB Pin
mike2k52-May-05 8:19
mike2k52-May-05 8:19 
GeneralRe: Get variables set in a SUB Pin
Het21092-May-05 18:48
Het21092-May-05 18:48 
GeneralSeperate decimal from whole number Pin
vertig07302-May-05 7:19
vertig07302-May-05 7:19 
GeneralRe: Seperate decimal from whole number Pin
chrismerrill2-May-05 7:49
chrismerrill2-May-05 7:49 
GeneralMortgage calulator loop question vb.net Pin
vb.net challenged2-May-05 6:16
vb.net challenged2-May-05 6:16 
GeneralHTML to IMAGE Pin
woklet2-May-05 5:02
woklet2-May-05 5:02 
GeneralStream problems Pin
CrazyEd161-May-05 23:35
CrazyEd161-May-05 23:35 
GeneralRe: Stream problems Pin
GeneralDisorder2-May-05 0:37
GeneralDisorder2-May-05 0:37 
GeneralProb in transferring ASP.NET Web Application Pin
vishalmishra1-May-05 23:15
vishalmishra1-May-05 23:15 
GeneralRe: Prob in transferring ASP.NET Web Application Pin
Christian Graus2-May-05 14:01
protectorChristian Graus2-May-05 14:01 
GeneralRe: Prob in transferring ASP.NET Web Application Pin
vishalmishra3-May-05 4:26
vishalmishra3-May-05 4:26 
GeneralRe: Prob in transferring ASP.NET Web Application Pin
Christian Graus3-May-05 13:18
protectorChristian Graus3-May-05 13:18 
GeneralCrystal Reports Pin
Madni Abbasi1-May-05 20:43
Madni Abbasi1-May-05 20:43 
Questionhow to assign NULL to Date Field ? Pin
Madni Abbasi1-May-05 20:37
Madni Abbasi1-May-05 20:37 
AnswerRe: how to assign NULL to Date Field ? Pin
Madni Abbasi1-May-05 21:11
Madni Abbasi1-May-05 21:11 

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.