|
Im not hugely experienced with using it but as far as i known you will need to install SQL Server Express on the target machine, or on a server if its a network application. I think you can download the redistributable for SQL server express. you will then need to include that in your setup application. Then once that is set up you can create your database on it and use it as, i assume, you are using it for testing
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi!
The plan is this database to be used at the client environment. It is a management system, so they will need to pull and insert data in their local database. That's why I have doubts how to build this setup, I have SQL Server installed on my machine, I am installing the application, trying to insert some data and the error is occuring. That's what I want to know, why that error is occurring, since I have installed SQL Server on my machine. Thanks for your help, Laziale
|
|
|
|
|
does you application work when you test it before adding the setup?
Can you also post some code in relation to the database connection
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
yes, when I am running and debugging within VS, it works fine, I am inserting, selecting, deleting data from database. When I am running like standalone application, it gives me the error what I said in the first post.
Here is some code where I am selecting some data:
SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + Environment.CurrentDirectory + @"\App_Data\CMS.mdf;Integrated Security=True;User Instance=True;");
conn.Open();
string selectFamilyID = "SELECT Family_Id, Family_Name FROM Families WHERE Family_HouseHold = '" + fullName + "';";
SqlCommand selectCommand = conn.CreateCommand();
selectCommand.CommandText = selectFamilyID;
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = selectCommand;
DataSet myDataSet = new DataSet();
string dataTableName = "Families";
adapter.Fill(myDataSet, dataTableName);
int familyID = 0;
DataTable table = myDataSet.Tables["Families"];
foreach (DataRow row in table.Rows)
{
familyID = Convert.ToInt32(row["Family_Id"]);
secondName = Convert.ToString(row["Family_Name"]);
}
|
|
|
|
|
hmmm. well i can only suggest that the application is not locating the file as expected.
You might want to try modifying the code so you get a OpenFileDialog prior to the connection. select you database location then use that information in the connection string. once you have done that test i VS, if that works then test with setup. If that also works then it must be something to do with the file path
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
The DB-filename isn't quoted. It might not find the file if there are spaces in the path to the database.
I are troll
|
|
|
|
|
how then is finding the file when I am running from visual studio?
|
|
|
|
|
I dunno, but by your reasoning a space can't be the problem
I are troll
|
|
|
|
|
But are you copying the database file to the installation directory. . .??
That means if you are installin it to some C:\Program Files\MyApplication\
then you need to copy the database file to that location. . .
According to me the main problem is in connection string . ..
What you can do is firstly you just give a message box showing the connection string by cn.ConnectionString.
So You can verify that the connection string is proper or not. . .
|
|
|
|
|
Greetings all!
My question:
From the main thread, how can I create two additional threads, each containing an object that will sit around and wait to be invoked? I want to do this because I don’t want the objects to be created and destroyed between invokes.
This is what I would like to do:
Have a main interface and two objects. The main form has 10 things it wants the objects to do, so upon starting it sends an item to each object via BeginInvoke (the objects are controls) to work and as soon as one of the objects is finished with an item, the main thread sends that object the next item to work, until all 10 are done.
Any help you can provide is much appreciated.
Thank you!
|
|
|
|
|
If by "the objects are controls" you mean "the objects are System.Windows.Forms.Control s" and you have your controls doing something business-y, then I think that you're wrong in your design and should look at something like the the ThreadPool class[^].
Furthermore, if those controls are Control s, then any updating that you want to do will have to be marshaled across thread boundaries back to the GUI thread.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thank you for the response!
The objects are System.Windows.Forms.WebBrowser that have been made a child on their own form. What I would like to do is make two of these forms in their own threads, then BeginInvoke the WebBrowser to do the work I need.
|
|
|
|
|
Well, that sounds great. I think that you should do that.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
D'oh! Threads, not processes!
That won't work. Windows requires all painting to occur on the UI thread. If it's somewhere else, then you'll get lots of .NET exceptions.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Anticast wrote: What I would like to do is make two of these forms in their own threads,
Nope. Won't work. The forms will not paint properly on anything other than the UI thread. The browser components will also have nasty issues work on a background thread, if they work for you at all.
|
|
|
|
|
As others have said you have to do all UI work in the UI thread. What you can do is to create worker threads for each form and have them do all the data crunching and then give the results back to the UI thread in order to display them. The only way you could get the forms into separate threads is to make each form a separate process entirely and use IPC to communicate between them and your main app.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Hello people, I have a project where i need to pass a file approx 2.68Gb or larger from one application to another. Now the problem is that in my project i have to use web services to do this operation.
I currently have the following setup in my code:
BinaryReader binReader = new BinaryReader(File.Open(parser.TemporaryFilesPath + "\\database.zip", FileMode.Open, FileAccess.Read));
binReader.BaseStream.Position = 0;
byte[] binaryfile = binReader.ReadBytes(Convert.ToInt32(binReader.BaseStream.Length));
binReader.Close();
sc.Helllo(binaryfile);
The above code is in my first application. Than in my web service appliciton i have the following code that writes the binary file to the temp location where it is stored.
[WebMethod]
public void Helllo(byte[] fileinbytes)
{
XMLParser parser = new XMLParser();
parser.CreateTemporaryDirectory();
BinaryWriter binWriter = new BinaryWriter(File.Open(parser.TemporaryFilesPath + "\\database.zip", FileMode.Create,FileAccess.ReadWrite));
binWriter.Write(fileinbytes);
binWriter.Close();
parser.Unzip();
parser.DecryptFiles();
parser.MergeXMLDataToDatabae("Centre to Main Database");
}
Now the problem is here in the first code block when the database.zip file increases in size its giving me the error "Value was either too large or too small for an Int32".Do you think there is a way which i can work around this or another way in which i cna program this. Thank you for your help and time guys apprciate it.
|
|
|
|
|
How about if you read the ZIP file into a buffer smaller than
int.MaxValue. Then, you can just loop until you've read it all.<br />
<br />
Just my $0.02, you should probably think of another way to do this than sending a > 2Gb file across the wire every time. <br />
<br />
<div class="ForumSig">"we must lose precision to make significant statements about complex systems."<br />
-deKorvin on uncertainty</div>
|
|
|
|
|
I use XmlTextReader to parse a supplied xml file. It is UTF-8 encoded, but a string read from a CDATA section does not display as a Unicode string.
Here is a very stripped down version of the xml file:
<?xml version="1.0" encoding="UTF-8"?>
<QuestionnaireDoc JobNo="New 1341 C" Description="New 1341 C" Week="2009-03-02" Template="DEV">
<QuesGroup Name="Tracks">
<TrackStudy Type="T" AdId="39240" Track="2">
<Title><![CDATA[Great Wall]]></Title>
<Content><![CDATA[It doesnâ?²t taste very good. Try xx Ciderâ?¢.]]></Content>
</TrackStudy>
</QuesGroup>
</QuestionnaireDoc>
The ReadString() method is used as follows:
o.Content = reader.ReadString(); // o.Content is String
o.Content contains "It doesnâ?²t taste very good. Try xx Ciderâ?¢.", not "It doesn′t taste very good. Try xx Cider™"
I've tried:
UTF8Encoding utf8 = new UTF8Encoding();
Byte[] encodedBytes = utf8.GetBytes(o.Content);
o.Content = utf8.GetString(encodedBytes);
but that makes no difference.
How do I decode this string? I have no control over the supplied xml file.
|
|
|
|
|
I don't think that it's the reader, I think that it's the renderer.
For example, if you're reading this content and rendering it in a browser that does not have UTF-8 as the default character set and you haven't used the META tag to set the character set or passed it as an HTTP header, then it will display badly.
Look at your renderer. The code looks fine.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I tried it, and with your file containing correctly UTF-8 encoded text it works without problems. I think that the text in the file isn't actually encoded as UTF-8, or that you have decoded UTF-8 as ANSI and then encoded the corrupted string as UTF-8.
Tim Beck wrote: I've tried:
UTF8Encoding utf8 = new UTF8Encoding();
Byte[] encodedBytes = utf8.GetBytes(o.Content);
o.Content = utf8.GetString(encodedBytes);
but that makes no difference.
Of course it doesn't. You are just encoding the string to UTF-8 and then decoding it again. That doesn't change how it's decoded when you read it from the file.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
if i use this code, do it have no sense
private int[] testProtery = new int[3];
public int[] TestProtery
{
get
{
return this.testProtery;
}
set
{
this.testProtery = value;
}
}
i want to uee the property to match the private filed of testProtery,
i feel this code don't work. please let me understand. thank you
|
|
|
|
|
clj19870503 wrote: i feel this code don't work
why would it not work?
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
sure, it'll work.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
for exampel , do i use this :
this.testProtery[0].TestProtery;
i don't understand, thank you .
|
|
|
|