Thanks for your help. That worked great.
kornstyle
Posts
-
How do I add Selected Cells -
How do I add Selected CellsI am using a datagridview control. I want to select multiple cells that contain numbers and add them. What would be the best way to do this? Thanks.
-
Need unique text in textboxesI want to check if the text is unique from the other 25 textboxes on the form.
-
Need unique text in textboxesI have a form with 26 textboxes on it. I need each textbox to have text that is unique from any other textbox on the form. What is an easy way to do this? Thanks
-
Having trouble updating access database.I am writing a program that updates a access database. I am filling a dataset with data from a comma delimited text file. Then I insert the dataset into the database with this piece of code.
OleDbAdapter.Update(dataSet1, "Table1");
This works great, but I also need to insert records to the database using a SQL insert statement. I am using the code below to insert a single record to the database.
"insert into Table1(col1, col2, col3)"
+ " values ('" + textBox1.Text + "', '"
+ textBox2.Text + "', '"
+ textBox3.Text + "')";This works great. The problem comes in when I try to insert another dataset. The correct number of records are added but every row is the same as the row from the SQL statement. I bound the dataset to a datagrid but the datagrid shows the correct data in each row. Please help me before I get fired. Thanks
-
Using Crystal Reports.Net with a password protected databaseI am using Crystal Reports.Net 2002. How do I connect to a password protected Access database? I have gone through the Report expert and chosen the database and entered the password. When I run the program however a "Database Login Screen" comes up asking for a: ServerName, Database, Login ID, and a Password. I tried to enter the Database path, I used "Admin" for the Login ID and the Password but all I got was "Login Failed please try again". I tried just entering the Database path and Password but got the same "Login Failed please try again" screen.
-
Connect to a password protected databaseYes I am using an Access database and I have tried to use Admin as the username but still is not working.
-
Connect to a password protected databaseI am trying to connect to a password protected database. I am using the "Configure Data Adapter Wizard". I can connect to the database when there is not a password set. When I set a database password I get the following error when I try to configure the adapter. "Test connection failed because of an error in initializing provider. Not a valid password." I have tried unchecking the "Blank Password" checkbox and entering in my password in the password box but then I get this error. "Test connection failed because of an error in initializing provider. Cannot start your application. The workgroup information file is missing or opened exclusively by another user."
-
File.Create method isn't releasing the fileI am using the File.Create method to create a text file. My problem is that when I need to write to that file after it has been created I get the error message "The process cannot access the file "C:\2005 Sim R4 MedAlu Data\TN.txt" because it is being used by another process.".
-
Having trouble closing crystal reports connectionI'm not using a dataset I made the connection using the Report Expert using the OleDb Connection. I am connecting to an access database.
-
Having trouble closing crystal reports connectionI don't know if this is the correct place to post this but I didn't see any Message Board for Crystal Reports. I am using the Crystal reports version that comes with Visual Studio 2002. I have my reports opening in a separate form. The reports work fine but when I close the form it seems like the connection used by crystal reports is still open because I cannot do anything to my database. Sometimes it times out and sometimes I need to restart my program to release the connection. How do I close the connection between crystal reports and the database? I've been searching online and haven't found very much on this. Thanks.
-
Stored Query in AccessI am trying to prevent duplicate records from being appended to my Access database. What I did was created two tables in Access. The first one "NewResultsTable" is populated with new records. I created a Query in Access "Query1" which appends the first database to the second database. The Table "NewResultsTable" is then cleared of all of its records. The table "TestResultsTable" has three primary keys:TestDate, TestTime, and SerialNumber. So when I run "Query1" while in Access, if all three of those primary keys are the same as any other three primary keys I will get an error message similar to the following. "Microsoft Access can't append all the records in the append query Microsoft Access didn't add (Number of records) to the table due to key violations To ignore the error and run the query, click Yes" I click yes the records that aren't duplicates are appended to "TestResultsTable". I wrote a small test program in C# and called the "Query1". When there where no duplicates the "TestResultsTable" is appended to no problem. When there are duplicates I get the following error. "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again." I don't know how to tell Access to continue and run the query. How can I do this? Or would it be easier to write a SQL statement? What would the SQL statement be that would do this same thing? Thanks to anyone who can help.
-
AxWebBrowser glitchI don't know if anyone else has had this problem with the AxWebBrowser. I have a AxWebBrowser on a form and it works great when I bring up the form for the first time. When I open the form for the second time however the AxWebBrowser control seems to become unattached from the form. It still shows up but it is just floating by itself. Do I need to use the dispose method for the AxWebBrowser when I close the form? If so how do I create the AxWebBrowser during runtime? I tried to do this but I'm doing something wrong because the Browser doesn't show up. I tried this code in the form's load event.
AxSHDocVw.AxWebBrowser WebBrowser = new AxSHDocVw.AxWebBrowser(); WebBrowser.Location = new System.Drawing.Point(8, 8); WebBrowser.Size = new System.Drawing.Size(100,100);
-
Convert a mdb datatable to a comma delimited text fileHow can I convert a datatable in MS Access into a comma delimited text file. thanks.
-
Closing Crystal Report's Database ConnectionI'm using crystal reports to view data in an access database. The problem I am having is that the report is not releasing the access database.The lock file is still there when I close the Form that the Report is in. I have to close the program and restart to release the database. I have tried the "Dispose" method when closing the form. That seemed to work for a while but I eventually had to close the program again because the database was not being released. Are there any suggestions? I would like to close the Report's connection to the database everytime that I close the Report's form.
-
Blobs are driving me insane!!!!!Thanks for Replying. Sorry if I wasn't clear. What I want to do is to write the contents of the memory stream to the field Photo2. I used the "?" but it still did not work. I am able to write the contents of the memory stream to a picture box. It is writing to the Photo2 field though because it says "Long binary data" in the Photo2 field. Any ideas
-
Blobs are driving me insane!!!!!What I want to do is choose a bitmap file, with a opendialogbox and save the bitmap to a field named "Photo" in the "Employees" table in the northwind database. I am not sure what to do, I think that the problem is in my SQL statement. What I want to do is pick a bitmap and save it to a mdb database. I am using the northwind database. Here is my code. I have been reading on this and have been able to copy a bitmap from the "Photo" field in the "Employees" table in the northwind database, to a field in the same table that I made named Photo2.
private void Form1_Load(object sender, System.EventArgs e) { this.oleDbDataAdapter1.Fill(ds1, "Employees"); IDTxtBx.DataBindings.Add("Text", ds1, "Employees.EmployeeID"); firstNameTxtBx.DataBindings.Add("Text", ds1, "Employees.FirstName"); bm = BindingContext[ds1, "Employees"]; bm.PositionChanged += new EventHandler(bm_PositionChanged); bm_PositionChanged(null, null); } private void bm_PositionChanged(Object sender, EventArgs e) { image = null; this.pictureBox1.Image = null; string sqlText = "SELECT Photo FROM Employees WHERE EmployeeID=" + IDTxtBx.Text; OleDbCommand cmd = new OleDbCommand(sqlText, oleDbConnection1); this.oleDbConnection1.Open(); try { int bufferSize = 100; byte[] outbyte = new byte[bufferSize]; long retVal = 0; long startIndex = 0; OleDbDataReader dr = cmd.ExecuteReader (CommandBehavior.SequentialAccess); dr.Read(); if(!dr.IsDBNull(0)) { MemoryStream ms = new MemoryStream(); retVal = dr.GetBytes(0, startIndex, outbyte, 0, bufferSize); while(retVal == bufferSize) { ms.Write(outbyte, 0, outbyte.Length); startIndex += bufferSize; retVal = dr.GetBytes(0, startIndex, outbyte, 0, bufferSize); } ms.Write(outbyte, 0, (int)retVal - 1); image = ms.ToArray(); } } catch(Exception ex) { MessageBox.Show(ex.ToString()); } finally { this.oleDbConnection1.Close(); } if(image != null) { MemoryStream ms = new MemoryStream(image); try { } catch(Exception ex) { MessageBox.Show(ex.ToString()); } ms.Close(); } } string sqlWrite = "UPDATE " + "Employees" + " SET Photo2 = Photo WHERE EmployeeID = " + IDTxtBx.Text; OleDbCommand cmdWrite = new OleDbCommand(sqlWrite, this.ole
-
crystal report picturesIs it possible to insert a jpg,gif or a bitmap file into a crystal report programmatically? If so can someone point me in the right direction. I've been looking on the web but can't seem to find anything about it.
-
Navigating a DatabaseI was still unable to find a way to increment and decrement my position in the database. I did this using windows form by first declaring a class level variable for the BindingManageBase object, BindingManagerBase bm; then assigning a table to it, bm = this.BindingContext[dataset1, "Records"]; and using the position property of the BindingManagerBase bm.Position ++; I want to do the same thing in ASP.NET. I searched through the recommended documentation as well as on google and msn but still can't find anything. Can someone help? Thanks.
-
Navigating a Database