Private Sub frmColour_Copy_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con = = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\Selom\Documents\Visual Studio 2005 \Projects\Printing And Copy1\Printing And Copy1\Database1.mdf;Integrated Security=True;User Instance=True")
Dim cmd As New SqlCommand
cmd.Connection = con
cmd.CommandText = "INSERT INTO customer(cust_name, cust_Age) VALUES( '" + strCustName+ "', '" + strCust_Age + "')"
Catch ex As Exception
MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
this code works on the pc it's being developed. the only problem is that after building the executable file using the setup Project and installed on the same machine, it displays the following error: Format of the initialization string does not conform to specification starting ar index 0
Again, thanks for replying. You are right about the path.
my only trouble is how to change it so that it works after the installation of the application on any machine.
I have changed it into :
Dim constring As String
constring = Application.StartupPath.ToString() + "\Database1.mdf"
Dim con = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=" + constring + ";Integrated Security=True;User Instance=True")
and selected the option "embedded resource" for the database file but it still not working and giving the following error code:
"An attempt to attach an auto-named database for file C:\Program File\App\Customerdb.mdf failed. A database with the same name exits, or specified file cannot be opened, or it is located on UNC share."
You cannot use the database if it's an embedded resource. Even if you could, it would be entirely ReadOnly. You wouldn't be able to add any data to it or modify it in any way.
The fullyqualified path to the database file should be either written to a config file at install-time or generated, using well-known folder paths, at run-time. It's then just a simple matter of inserting the path into the connection string when needed.
Hi every body i am making a windows application and i need to make a button in my menu bar like in the microsoft word where u can find the recent documents that u have opened so i need to display all the forms that i have opened from the newest till the older and when i click i need to open the document
Where can I find documentation about the byte() from RegionData.data. Specifically I am trying to figure out how to get a path from it. The regions I will be creating will have several polygons. I want to use the Region manipulation functions (Union, Exclude, etc.) and then create a path from the resulting RegionData.data.
I was looking to try to use the Region class to do some boolean operations on polygons too, not so much for graphics, but for other purposes.
Anyway, I managed to decode the RegionData structure enough to find out that it does not seem to give the resultant set of points after the operation that we are looking for. Essentially, all it appears to contain is the starting region and a record of the operations you have performed. I'm sure there's something buried in GDI+ that actually applies the operations, but I don't think RegionData is it.
I have an Isometric grid that gets drawn to a bitmap bigger then the screen, then the section of it that has been scrolled to is drawn. How can I figure out where on the grid the user clicked? Should I create an invisible normal square grid over the isometric one? It wouldn't perfect but it might work. Please help
Have you tried the Krypton Toolkit? http://www.componentfactory.com/free-windows-forms-controls.php
I would have expected you to track the scroll position and the x/y coords of the mouse click to track where the user is in relation to the grid. I wonder if the scroll an absolute or is it diffetent for different resolution monitors?
Never underestimate the power of human stupidity
Hi I have Visual Studio 2008 installed and I am working on a Windows Form with a menu.
I have builded all the elements of menu File...View ..Edit and also added shortcuts.
Everything seems fine on Ddesign View but when I build -run project I can see only the menu without shortcuts.What's going on??
I have an application in which i create a thread to run a certain process.
There is a api function call in the thread that tries to connect through TCP/IP to a device and get some data from it.If the device is disconnected then I get a socket exception.
I need to handle this exception however I found out during debugging that even though the exception was thrown,it went unhandled even though I put a try catch block.
However when i run it on the Main UI thread everything is fine.
After doing some searches on this issue I have understood that general exceptions cannot be handled in threads?Is this correct?
If so,is there a way to handle this socket exception?If any one has any idea about this or can direct me to any good articles on this...really appreciate it..
I would guess you tried and did something to the GUI inside the catch block, violating the "only main/GUI thread should ever touch any Control" rule, which causes another exception and that one does no longer get caught by your try-catch since you are already in the catch block.
Experiment with Console.WriteLine() or some file operation to confirm my theory, then start using the Control.InvokeRequired/Control.Invoke pattern.
Luc Pattyn [Forum Guidelines][My Articles] The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
Last Visit: 31-Dec-99 18:00 Last Update: 21-Sep-23 1:54