473,586 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent please take a look and help if you can

19 New Member
hi guys

I posted the other day regarding a solution i needed to design, im new to development an asp,net and built a local post office search tool using asp.net 2. vb in visual studio, using an sql express mdf database(this means the database is transferable with the solution even if the server doesnt have sql server on it) The app works fine, users can search, admins can edit data, insert and delete. The site also has membership and role management.

My problem is that i needed to be able to have a user browse a csv file and upload it into a datagrid and then the database. ive got the following but recieve an error when running it.

upload.aspx
Expand|Select|Wrap|Line Numbers
  1. %@ Page Language="VB"%>
  2. <%@ Import Namespace="system.io" %>
  3. <%@ Import Namespace="System.Data" %>
  4. <%@ Import Namespace="system.data.sqlclient" %>
  5. <%@ Import Namespace="system.configuration" %>
  6.  
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  8.  
  9. <script runat="server">
  10.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
  11.         If (IsPostBack) Then
  12.             Grid.Visible = True
  13.         Else
  14.             Grid.Visible = False
  15.         End If
  16.     End Sub
  17.     Protected Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  18.         If OpenFileDialog1.HasFile Then
  19.             Dim fi As New FileInfo(OpenFileDialog1.FileName)
  20.             Dim strConn As String = System.Configuration.ConfigurationManager.AppSettings("connectionstring") & fi.DirectoryName
  21.             Dim connection As New SqlConnection("strConn")
  22.             Dim MySql As String = "SELECT * FROM " & fi.Name
  23.             Dim objDR As SqlDataReader
  24.             Dim Cmd As New SqlCommand(MySql, connection)
  25.             connection.Open()
  26.             objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
  27.             Grid.DataSource = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
  28.             Grid.DataBind()
  29.         Else
  30.             Label1.Text = "You have not specified a file."
  31.         End If
  32.     End Sub
  33. </script>
  34.  
The webconfig file
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  3.     <connectionStrings>
  4.         <remove name="LocalSqlServer" />
  5.         <add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|PostOffice.mdf;User Instance=true"
  6.             providerName="System.Data.SqlClient" />
  7.         <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\PostOffice.mdf;Integrated Security=True;User Instance=True"
  8.             providerName="System.Data.SqlClient" />
  9.     </connectionStrings>
  10.     <system.web>
  11.         <roleManager enabled="true" />
  12.         <authentication mode="Forms" />
  13.     </system.web>
  14. </configuration>
  15.  
the error message
Server Error in '/MerlinLocalPost OfficeApp' Application.
--------------------------------------------------------------------------------

Format of the initialization string does not conform to specification starting at index 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Argument Exception: Format of the initialization string does not conform to specification starting at index 0.

Source Error:


Line 19: Dim fi As New FileInfo(OpenFi leDialog1.FileN ame)
Line 20: Dim strConn As String = System.Configur ation.Configura tionManager.App Settings("conne ctionstring") & fi.DirectoryNam e
Line 21: Dim connection As New SqlConnection(" strConn")
Line 22: Dim MySql As String = "SELECT * FROM " & fi.Name
Line 23: Dim objDR As SqlDataReader


Source File: c:\inetpub\wwwr oot\MerlinLocal PostOfficeApp\A dministrator\Up load2.aspx Line: 21

Stack Trace:


[ArgumentExcepti on: Format of the initialization string does not conform to specification starting at index 0.]
System.Data.Com mon.DbConnectio nOptions.GetKey ValuePair(Strin g connectionStrin g, Int32 currentPosition , StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +1242
System.Data.Com mon.DbConnectio nOptions.ParseI nternal(Hashtab le parsetable, String connectionStrin g, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +128
System.Data.Com mon.DbConnectio nOptions..ctor( String connectionStrin g, Hashtable synonyms, Boolean useOdbcRules) +102
System.Data.Sql Client.SqlConne ctionString..ct or(String connectionStrin g) +52
System.Data.Sql Client.SqlConne ctionFactory.Cr eateConnectionO ptions(String connectionStrin g, DbConnectionOpt ions previous) +24
System.Data.Pro viderBase.DbCon nectionFactory. GetConnectionPo olGroup(String connectionStrin g, DbConnectionPoo lGroupOptions poolOptions, DbConnectionOpt ions& userConnectionO ptions) +125
System.Data.Sql Client.SqlConne ction.Connectio nString_Set(Str ing value) +56
System.Data.Sql Client.SqlConne ction.set_Conne ctionString(Str ing value) +4
System.Data.Sql Client.SqlConne ction..ctor(Str ing connectionStrin g) +21
ASP.administrat or_upload2_aspx .UploadButton_C lick(Object sender, EventArgs e) in c:\inetpub\wwwr oot\MerlinLocal PostOfficeApp\A dministrator\Up load2.aspx:21
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +105
System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument) +107
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +7
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +11
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5102


Please try and help in anyway, im a really newbie so try and dumb it down for me.

Thanks in advance
Feb 14 '07 #1
1 3202
kenobewan
4,871 Recognized Expert Specialist
Most likely cause of initial error is the connection string. Please see: Connection Strings. Your connection string looks a problem too...
Feb 15 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1894
by: Rajesh Garg | last post by:
I have a scenario like this....... update esan set tes_address_city = 'TEST1' --at some time update esan set tes_address_city = 'TEST12' --at some time update esan set tes_address_city = 'TEST123' --at some time backup database TESTWMS to disk = 'D:\temp\RecoveryTest\TESTWMS.db' backup log TESTWMS to disk =...
6
4705
by: Rajesh Garg | last post by:
I have actually extended my request I have a scenario like this....... update esan set tes_address_city = 'TEST1' --at some time update esan set tes_address_city = 'TEST12' --at some time update esan set tes_address_city = 'TEST123' --at some time backup database TESTWMS to disk = 'D:\temp\RecoveryTest\TESTWMS.db' backup log TESTWMS to...
3
6702
by: Liu Ju | last post by:
Dear members: I want to use the multithread in my program which is developed in Visual C++ platform (version 6). I created a controlling function: UINT CCOMM1Dlg::WritingThreadFunc(LPVOID pParam) for a thread The reason that I want it to belong to the class CCOMM1Dlg is that in this function I need to process some member variables of the...
8
5226
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is developing a web-based application, one part of which involves allowing the user the ability to page through transaction "history" information. The...
1
1633
by: Rahul S. | last post by:
Hey all: I need urgent information how to set the environment in Visual.NET wiritng in C. I am working with a licensed version of the Analyze 6.0 software from mayo clinic. I need to write code in C using AVW functions that are licensed by Mayo clinic. In order to access the AVW library of functions, I need to set the
3
1734
by: Rahul S. | last post by:
Hey all: I need urgent information how to set the environment in Visual.NET wiritng in C. I am working with a licensed version of the Analyze 6.0 software from mayo clinic. I need to write code in C using AVW functions that are licensed by Mayo clinic. In order to access the AVW library of functions, I need to set the
1
1280
by: newbie | last post by:
Hi I am using a toolkit written in c++ that consists of three parts 1) video captur 2) image processin 3) OpenGL wrappe The video capture program only works with local hardware (for example usb web cam). Since I have to use a remote live camera with a fixed IP-address, I then have to write my own video capture program that replaces the...
5
1152
by: VB Programmer | last post by:
When I go to create a new ASP.NET web application VS 2003 freezes on this message: Contacting server to create Web project 'WebApplication1'... I checked my file system and the C:\Inetpub\wwwroot\WebApplication1 directory is created. One file is in there called vs-211169597029639694_tmp.htm. There are NO SUBFOLDERS created. Also,...
17
2273
by: Saps | last post by:
Hi all. Can anyone help me here. I have loads of .sql files and i need a way to call these from my asp page so the user can run them from the browser. Meaning i have a page with a list of all scripts. each when clicked i am able to run the script. so HOW and what do i do to call and run the .sql Thanks
3
1539
by: settyv | last post by:
Hi, I need to generate PDF stream when i click on Linkbutton in datagrid ..At present i hardcoded the DMS Id and now it is working.But i need to pass DMS ID when click linkbutton.How can i do that? Here is the ASPX code: <asp:datagrid id="grdTentativeResults" Width="800" Runat="server"
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.