
flynn
Avatar/Signature-
Posts
59 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by flynn
-
Sorry, yes it is MS SQL 2005 and thank you, that seems to have done it for me. Would this be the correct way to add a PK on multiple columns (it seems to work ok)? CREATE TABLE "DBO"."pricing" ( "item_id" integer NOT NULL , "price_class" smallint NOT NULL CONSTRAINT "PK_pricing" PRIMARY KEY ("item_id", "price_class") , "quantity" integer NOT NULL , "price" numeric(10,2) NOT NULL , "profit_code" char(1) NULL , )
-
When I use this syntax to create a new table (and primary key), the command works as it is supposed to: CREATE TABLE "DBO"."promotion" ( "item_id" integer NOT NULL , "start_date" datetime NOT NULL , "end_date" datetime NOT NULL , "buy_quantity" integer NULL , "receive_quantity" integer NULL , "receive_item_id" integer NULL , "promo_id" varchar(17) , "description" text NULL , "customer_key" integer NULL , "parent_item_id" integer NULL , PRIMARY KEY ("item_id"), ) The only problem is that the Primary Key gets named with a seemingly random set of characters at the end of the name, as in: PK__promotion__78173351 but if I omit the "PRIMARY KEY" clause from the CREATE statement and run this command: ALTER TABLE "promotion" ADD CONSTRAINT "PK_promotion" PRIMARY KEY ("item_id") the primary key is named as I wanted it ("PK_promotion"). Can I get the "PRIMARY KEY" clause to name the key from a string that I specify? Or am I going to have to CREATE the table first, then issue an ALTER command? tia, flynn
-
It does, but it expects a generic object as the parameter. Instead, I'll just run a for loop through the array until I find the one I need to remove. Should be fairly quick since there should only be 10 menu items at most.
-
I am using the new ToolStripMenuItem in .Net 2.0, which replaces MenuItem. MenuItem has an "Index" property, but ToolStripMenuItem does not. Is there a way to determine the index of the currently selected menu item from within a "Click" event? What I'm trying to accomplish is to remove a menu item when it's clicked, then put this same menu item at the top of the menu (the menu is a Most Recently Used list). private void OnMRUClicked(object sender, EventArgs e) { ToolStripItem item = (ToolStripItem)sender; // remove the menu item from its current location... mruList.RemoveAt(item.Index); // <--- error, no Index property // ...and add it to the top of the MRU menu mruList.Insert(0, mru); } tia, flynn
-
The document located at: http://msdn2.microsoft.com/en-us/library/ms142557(d=ide).aspx has this note listed: "In Microsoft SQL Server 2005, all databases are full-text enabled by default. " But when I try this query: select description from item where contains(description, '"model"') I get this message: Msg 7601, Level 16, State 2, Line 1 Cannot use a CONTAINS or FREETEXT predicate on table or indexed view 'item' because it is not full-text indexed. I am using SQL Server Express, so that might make a difference. Has anyone successfully used full-text search with SQL Server Express 2005? I am trying to find out how to enable the search, but haven't had any luck so far. Thanks for any help provided, flynn
-
Given the following setup: 3 forms: MDIParent, Child1 and Child2 2 Access tables: Table1 and Table2 (tables are totally unrelated) If I create a global database connection string from MDIParent, can I modify data in Table1 (from Child1) and Table2 (from Child2) using the same connection string at the same time without causing corruptions? tia, flynn
-
I am wanting to add an item to a combobox, so I thought I could do something like this: dim cboItem as ComboBoxItem cboItem = ComboBox1.add() cboItem.text = "123" cboItem.tag = "abc" Is there a way to create a combobox item, then set the values of that item? tia, flynn
-
Thanks Cags, I was hoping for better news. Have you seen the way MSN Messenger looks? Surely they don't get the transparency to work by doing as you have described.
-
I have placed a Tab control and a Text box on a form. I have a background image on the form. If I place a Checkbox on the form and set its backcolor to "Transparent", the image will show through the Checkbox. I would like to have the Tab control and Text control do the same thing, but they don't support the backcolor property. The MSN messenger program allows something similar to this. The textboxes allow the image to show through. This is what I am after. Is there something I'm missing? Does anyone have code that shows how to do this? tia, flynn
-
It is my understanding that in order to get an Icon to display in the system tray, I need to use the NotifyIcon. Using the code below, I can get my application to work similar to other tray apps. I say similar in that when I click the "Close" button, the app will minimize, but instead of minimizing to the tray (like MSN messenger with the animation), my app minimizes just above the "Start" button. Is there a way to get the animation to go to the system tray? To get around this, I hide the app first, then minimize so you don't even see the minimize animation. private void Form1_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) this.Hide(); }
-
I have an Access database that can be opened with the following connection string: conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Databases\GFM.mdb;User Id=admin;Password=;") I have created a System DSN that points to this database. Question is: Can I use the DSN in the connection string instead of hard coding the full path name? tia, flynn
-
Excellent, Thank You PlausiblyDamp, and Thank You dynamic_sysop for the example.
-
Can anyone point me to the C# equivalent of the C++ CHttpFile object? Basically the C++ code just queries the size of a BINARY file that will be downloaded, sets up a progress bar and then does the download. Here is what I am converting: CHttpFile *pHttpFile; CFile file; pHttpFile = (CHttpFile*)NetSession.OpenURL(m_cstrHTTPServer + "/TestFile.exe", 1, INTERNET_FLAG_TRANSFER_BINARY | INTERNET_FLAG_RELOAD); // get the length of the file dwTemp = 0; if (pHttpFile->QueryInfo(HTTP_QUERY_CONTENT_LENGTH, cstrTemp)) dwTemp = atol(cstrTemp); if (file.Open(m_cstrUpdatePath, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary)) { // copy 1KB at a time from server to local file UINT nRead = pHttpFile->Read(szBuff, 1023); while (nRead > 0) { file.Write(szBuff, nRead); // make sure messages are still processed during this loop MSG msg; if(::PeekMessage(&msg,m_hWnd,0,0,TRUE)) { ::TranslateMessage(&msg); ::DispatchMessage(&msg); } if (m_bStop) break; m_ctrlProgress.StepIt(); // Add in bytes read ulTotalRead += nRead; cstrTemp.Format("Downloaded %d KB out of %d KB (%d%%).", ulTotalRead / 1024, dwTemp / 1024, (int)(((double)(ulTotalRead) / 1024.00) / ((double)(dwTemp) / 1024.00) * 100.00)); m_stStatus.SetWindowText(cstrTemp); nRead = pHttpFile->Read(szBuff, 1023); } file.Close(); } I could use this: System.Net.WebClient client = new System.Net.WebClient(); client.DownloadFile(UpdateServer + "/TestFile.exe","C:\\Data\\TestFile.bin"); which works, but doesn't allow me to update a progress bar like the C++ code. Does anyone have a C# example I could look at? tia, flynn
-
I am using this code to disable the "X" (close) control on a .Net 2.0 form, but is there a better way? I'd rather use code from the .Net framework instead of VB6 code. Public Class Form1 Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal bRevert As Integer) As Integer Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer Public Const SC_CLOSE = &HF060& Public Const MF_BYCOMMAND = &H0& Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated Dim SysMenuHandle As Integer SysMenuHandle = GetSystemMenu(Me.Handle().ToInt32(), False) RemoveMenu(SysMenuHandle, SC_CLOSE, MF_BYCOMMAND) End Sub End Class tia, flynn
-
Is there a way to add checkboxes to a user-defined collection of checkboxes similar to the concept below? ControlCollection ctrlWeekday = {chkMonday, chkTuesday, chkWednesday, chkThursday, chkFriday}; ControlCollection ctrlWeekend = {chkSaturday, chkSunday}; ControlCollection ctrlAllWeek = {ctrlWeekday, ctrlWeekend}; tia, flynn
-
I am doing a lot of text manipulation and reading of text files. Example: Dim sb As System.Text.StringBuilder ' this line gives an error since ReadAllText returns a STRING sb = My.Computer.FileSystem.ReadAllText("c:\data\file1.txt") Is there a function similar to ReadAllText that will return a Stringbuilder? Or can I convert the return value to a Stringbuilder efficiently? tia, flynn
-
I think maybe the answer to my question is to use a StringBuilder. The .Chars method is read/write.
-
I know the following code doesn't work (.Chars is read-only), but hopefully you'll understand what I am wanting to do: I want to cycle through sBuffer to remove certain QUOTE characters that are contained within certain phrases. Is there a method that is writable that I can copy the valid characters into? Something similar to the .Chars method, but also writable. While iOldIndx < iFileLength If (sBuffer.Chars(iOldIndx) <> """") Then 'keep this character by copying to the new buffer sNewBuf.Chars(iNewIndx) = sBuffer.Chars(iOldIndx) iNewIndx += 1 End If iOldIndx += 1 End While tia, flynn
-
Joe, I used the code above but got this: System.Data.Odbc.OdbcException was caught ErrorCode=-2146232009 Message="ERROR [HY104] [Microsoft][ODBC Microsoft Access Driver]Invalid precision value " Source="odbcjt32.dll" StackTrace: at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) at System.Data.Odbc.OdbcParameter.Bind(OdbcStatementHandle hstmt, OdbcCommand command, Int16 ordinal, CNativeBuffer parameterBuffer, Boolean allowReentrance) at System.Data.Odbc.OdbcParameterCollection.Bind(OdbcCommand command, CMDWrapper cmdWrapper, CNativeBuffer parameterBuffer) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader) at System.Data.Odbc.OdbcCommand.ExecuteNonQuery() at DataParser.Main.btnSaveData_Click(Object sender, EventArgs e) in C:\Documents and Settings\jeff wohltman\My Documents\Visual Studio 2005\Projects\DataParser5\DataParser\Main.vb:line 560 I used this Microsoft page to determine if I have the current driver, which I do: http://support.microsoft.com/default.aspx?kbid=239114#XSLTH3120121123120121120120 Are you saying that I am using the ODBC driver where I should be using the OLE driver? If so, do you have a link to the current OLE driver? I couldn't find it by wading through all the muck returned by Google. EDIT: I found a Microsoft page that shows the files that are in the latest update. I have the OLEDB driver (I think): msjetoledb40.dll (351k). How do I setup the DSN to use this driver? Or can I not use a DSN with the OLEDB driver? tia, flynn
-
I can insert records into an Access database with this statement: cmdAdd.CommandText = "INSERT INTO tblTest (Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8) VALUES" & _ "('" & Parm1 & "','" & _ Parm2 & "','" & _ Parm3 & "','" & _ Parm4 & "','" & _ Parm5 & "','" & _ Parm6 & "','" & _ Parm7 & "','" & _ Parm8 & "')" cmdAdd.ExecuteNonQuery() but if I try to parameterize the statement like this: cmdAdd.CommandText = "INSERT INTO tblTest (" & _ "Parm1, Parm2, Parm3, Parm4, Parm5, Parm6, Parm7, Parm8) VALUES (" & _ "@Parm1, @Parm2, @Parm3, @Parm4, @Parm5, @Parm6, @Parm7, @Parm8)" cmdAdd.Parameters.Add("@Parm1", OdbcType.VarChar, 8).Value = lvItem.Text cmdAdd.Parameters.Add("@Parm2", OdbcType.VarChar, 50).Value = lvItem.SubItems(1).Text cmdAdd.Parameters.Add("@Parm3", OdbcType.Date, 10).Value = CDate(lvItem.SubItems(2).Text) cmdAdd.Parameters.Add("@Parm4", OdbcType.VarChar, 255).Value = lvitem.SubItems(3).Text cmdAdd.Parameters.Add("@Parm5", OdbcType.VarChar, 255).Value = lvitem.SubItems(4).Text cmdAdd.Parameters.Add("@Parm6", OdbcType.VarChar, Int32.MaxValue).Value = lvitem.SubItems(5).Text cmdAdd.Parameters.Add("@Parm7", OdbcType.VarChar, 255).Value = lvitem.SubItems(6).Text cmdAdd.Parameters.Add("@Parm8", OdbcType.VarChar, 50).Value = lvitem.SubItems(7).Text cmdAdd.ExecuteNonQuery() I get this error: System.Data.Odbc.OdbcException was caught ErrorCode=-2146232009 Message="ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 8." Source="odbcjt32.dll" StackTrace: at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader) at System.Data.Odbc.OdbcCommand.ExecuteNonQuery() at DataParser.Main.btnSaveData_Click(Object sender, EventArgs e) in C:\Visual Studio 2005\Projects\Data\Data1\Main.vb:line 574 Any suggestions? tia, flynn
-
-
Just as a simple test, I am trying to save html page source to a memo field in Access. The INSERT statement is: cmdAdd.CommandText = "INSERT INTO tblWebData (PersistentID, ArticleDate, ArticleText, sURL) VALUES" & _ "('" & sPersistentID & "','" & _ CDate(lvItem.SubItems(1).Text) & "','" & _ sPageText & "','" & _ lvItem.SubItems(3).Text & "')" The INSERT worked before I added the sPageText variable (I tested the code by adding a blank string to the database) to the statement. The page source contains all sorts of tick marks, quote marks and other characters typical in html. My guess is that the data is causing the exception error: "ERROR [42000] [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression Question is this: is there a way to store this data while preserving all the html? tia, flynn
-
I need to determine what data is being sent to a web site when I click the "process" button. I need to be able to automate (if possible) a query that is being sent. This automation will include changing several parameters on the initial query page. I am hoping to manipulate the URL that is being sent or even better, generate the URL dynamically through code. Are there any tools that will allow me to see what is being sent to the server? Is it even possible to manipulate the query if it is NOT being sent as a URL? Are there other suggestions that would work? tia, Flynn
-
The .Net package from Microsoft contains 4 or 5 really nice posters that can be placed on a wall. These posters document the classes, show multi-tier development processes, etc. Does anyone have an MSDN link to find/buy copies of these posters? tia, flynn