
cpopham
Avatar/Signature-
Posts
275 -
Joined
-
Last visited
Personal Information
-
Visual Studio .NET Version
2002, 2003
cpopham's Achievements
Newbie (1/14)
0
Reputation
-
I attempting to store my MySql connection string in my web.config file and I keep getting an error. My web.config file looks like the following: <configuration> <connectionStrings> <add name="TestIt" connectionString="Server=localhost;user id=MyUser;password=MyPW;database=test;" providerName="mysql.data.mysqlclient"/> </connectionStrings> <system.web> <sessionState timeout="60" cookieless="AutoDetect" regenerateExpiredSessionId="true" /> <compilation debug="true" strict="false" explicit="true"> <assemblies> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation> <pages> <namespaces> <clear/> <add namespace="System"/> <add namespace="System.Collections"/> <add namespace="System.Collections.Specialized"/> <add namespace="System.Configuration"/> <add namespace="System.Text"/> <add namespace="System.Text.RegularExpressions"/> <add namespace="System.Web"/> <add namespace="System.Web.Caching"/> <add namespace="System.Web.SessionState"/> <add namespace="System.Web.Security"/> <add namespace="System.Web.Profile"/> <add namespace="System.Web.UI"/> <add namespace="System.Web.UI.WebControls"/> <add namespace="System.Web.UI.WebControls.WebParts"/> <add namespace="System.Web.UI.HtmlControls"/> </namespaces> </pages> <authentication mode="Forms"/> </system.web> </configuration> My code that ues the connectionstring looks like the following: connMyTCO.ConnectionString = "<%$ connectionStrings:TestIt %>" Now the connection worked fine until I added it to the web.config file. After adding it to the web.config file I get the following error: Index was outside the bounds of the array. 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.IndexOutOfRangeException: Index was outside the bounds of the array. Source Error: Line 17: Private Sub OpenDB() Line 18: 'connMyTCO = New MySqlConnection Line 19: connMyTCO.ConnectionString = "<%$ connectionStrings:TestIt %>" Line 20: Try Line 21: connMyTCO.Open() Source File: C:\WebSites\TCO2\App_Code\DataTier.vb Line: 19 Any Ideas? Thank you, Chester
-
I have been attempting to find out how to cache a dataset into the clients browser cache. I am going to have users which will have information in a database that is for them. Each user will have different information, so instead of caching the dataset on the server, I want to cache it on the users computer. Can someone help me out? Thank you, Chester
-
I have a database that has all zip codes in the US plus the lat and long of each zip code. I am trying to come with a way to get all zip codes within a certain distance of a zip code. I have figured the best way is to get a sqare around the origin (zip code) and then if then if the lat or long falls outside of this box, then reject it and if it falls within, then get it. I am having a problem though trying to establish a latitude and longitude from the starting point based on miles. If I could do this, then I could pass these two the database and retrieve all the zip codes in the area. Does anyone have an idea of how to go about getting latitudes and longitudes of certain miles from a starting point? Thanks, Chester
-
Okay, I have not done a whole lot with ASP .NET 1.0-2.0. But I know enough to stumble my way through. I also know that my space has been switched from ColdFusion to ASP.NET 2.0. Now my question is, using VB and ASP, is it possible to write your own scripts to do change your profile the you want it to be or what? Does anyone know of any samples? Thanks, Chester
-
I had read about going about it that way last night. Do you know of any examples? I was not able to find any examples, just discussions on using a Windows service and possibly using the Windows service with and ASP .NET Web service to do scheduled maintenance on an ASP .net application. Thanks, Chester
-
I have not worked with asp .net a whole lot. I am building a asp.net website for customers that will have a calendar of events. They need the application to check the the calendar and when there is an event send out an email the day before to those user that requested a notification of that event. Is there anyway I can get the web server to handle this? If so, how do I get it to check the calendar like at midnight or whenever to send the email if necessary? Thanks, Chester
-
I think what I am going to do is either use a hidden list box or an array that contains will store the file names. I will then have a module level variable that will keep track of the file that is currently being check. When the user clicks okay for the file, I will have the sub get the current count from the vairable, add one to it and then go to that file. I think that may be the most simple way of implementing it. Thanks for the help guys! Chester
-
I am looping thought all of the files in a directory. Easy enough, now I am putting the file name of each file in a textbox for my user to check as the loop goes through each file. After the user verifies the file, they press a button to continue to the file in the loop. My question is, how can I get my loop to stop at each file after putting the file info in the textbox and then waiting for my user to click OK. I guess I want the loop to pause when it gets to the user verification point and then resume when the user presses the button. Any ideas? Thanks, Chester
-
I am building a small program and it will be using Access as the backend. The database has a field that contains quotations, such as those by presidents, etc. These quotes will be entered by a user and as such may contain quote marks ("), apostrophes ('), commas (,), ampersands (&), and possibly any other special character that my come to mind. I know about the trouble Access has handling the single apostrophe and how you should handle it by replacing it with a double apostrophe, but will I run into any other problems either with the string variable in VB .Net or Access with the other possible charachters such as quotaion marks (") and ampersands (&) and if so, how is the best way to handle them, so that they will be in the database, but now cause any problems? Thanks, Chester
-
I looked at that, but I am wanting to put the map in a picturebox on a winform, not an asp page, so that does not really help because it is for a web page. I had read a couple of articles that said you can convert the webpage to a bitmap and display it that way using a picturebox which is what I was attempting to do. Chester
-
I am trying to generate an image from a url and load it into a picturebox, but I keep getting an invalid parameter error on my URL. I am attempting to use google maps and had an entire map path, but dropped it down to just the maps URL and still getting the error. Can someone let me know what is wrong with my code: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'LoadWebImageToPictureBox(PictureBox1, "http://maps.google.com/?q=113+gunn+road" & Chr(44) & "+centerville" & Chr(44) & "+ga" & Chr(44) & "+31028&z=2&t=h") Try Dim req As Net.HttpWebRequest = DirectCast(Net.HttpWebRequest.Create("http://maps.google.com/?q=1113+watson+blvd,+warner+robins,+ga,+31028&z=2&t=h"), Net.HttpWebRequest) Dim res As Net.HttpWebResponse = DirectCast(req.GetResponse, Net.HttpWebResponse) Dim img As Image = Image.FromStream(res.GetResponseStream) res.Close() PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize PictureBox1.Image = img Catch ex As Exception MessageBox.Show(ex.Message) End Try PictureBox1.Image = New System.Drawing.Bitmap(New IO.MemoryStream(New System.Net.WebClient().DownloadData("http://www.google.com/"))) End Sub
-
I have an Access MDB file and I have compacted an repaired it, but it has errors. It has created a MSysCompactError that has the errors in it. There is a binary column in the error table that has a bookmark to the offending row. I have found a module an access module that is suppose to give you the rows that had problems. I am trying to build something similar in vb .net to get the corrupt rows. This is the module code for access: Sub main() On Error GoTo ErrorHandler Dim db As DAO.Database, vBookMark As Variant, _ rsMSysCompactError As DAO.Recordset, strErrorTable As String, _ rsErrorTable As DAO.Recordset, fldErrorField As DAO.Field, _ strSQLSEL As String, strColumnValue As Variant, _ qdTemp As QueryDef, strSQLINS As String, intLoop As Integer, _ lngTableNameLength As Long, _ colErrorCollection As New Collection, intErrorCount As Integer Set db = CurrentDb() ' Walk through the MSysCompactError table to find rows that reflect ' lost data values. Set rsMSysCompactError = db.OpenRecordset("SELECT * FROM MSysCompactError WHERE ErrorRecId IS NOT NULL", dbOpenDynaset) intErrorCount = 0 While Not rsMSysCompactError.EOF ' Get the name of the table that had column data missing. strErrorTable = rsMSysCompactError!ErrorTable ' Check to see that tablename is not greater than 48 characters ' to stay under 64 character tablename limit. lngTableNameLength = Len(strErrorTable) If lngTableNameLength > 48 Then strErrorTable = Mid(strErrorTable, 1, 48) ' See if this truncated table name already exists. On Error Resume Next colErrorCollection.Add strErrorTable, strErrorTable ' If this already exists in the collection, then there is a ' duplicate table name. If Err = 457 Then ' Truncate one more digit to append on the intErrorCount ' number to eliminate the duplicate table name. strErrorTable = Mid(strErrorTable, 1, 47) strErrorTable = strErrorTable & Mid((Str(intErrorCount)), 2, 1) intErrorCount = (intErrorCount + 1) End If End If ' Get the bookmark value of the row that had lost column data. vBookMark = rsMSysCompactError!ErrorRecId ' Open table that has lost column data. Set rsErrorTable = db.OpenRecordset(strErrorTable, dbOpenTable, dbReadOnly) ' Move to row that has lost column data. rsErrorTable.Bookmark = vBookMark ' Start to build SQL string to call up in a table window. strSQLSEL = "SELECT * INTO MSysCompactError" & strErrorTable & " FROM " & strErrorTable & " WHERE " strSQLINS = "INSERT INTO MSysCompactError" & strErrorTable & " SELECT * FROM " & strErrorTable & " WHERE " intLoop = 0 For Each fldErrorField In rsErrorTable.Fields strColumnValue = fldErrorField.Value ' Logic to build predicate based on various data types. If Not IsNull(strColumnValue) Then ' Can't use ordinal as no guarantee of first column ' being zero. ' Check to see if this is the first column or not to ' build SQL statement. If intLoop = 0 Then If fldErrorField.Type = dbDate Then strSQLSEL = strSQLSEL & "[" & fldErrorField.Name & "] = " & "#" & strColumnValue & "#" strSQLINS = strSQLINS & "[" & fldErrorField.Name & "] = " & "#" & strColumnValue & "#" Else If fldErrorField.Type = dbText Or fldErrorField.Type = dbChar Or fldErrorField.Type = dbMemo Then strSQLSEL = strSQLSEL & "[" & fldErrorField.Name & "] = " & "'" & strColumnValue & "'" strSQLINS = strSQLINS & "[" & fldErrorField.Name & "] = " & "'" & strColumnValue & "'" Else strSQLSEL = strSQLSEL & "[" & fldErrorField.Name & "] = " & strColumnValue strSQLINS = strSQLINS & "[" & fldErrorField.Name & "] = " & strColumnValue End If End If Else If fldErrorField.Type = dbDate Then strSQLSEL = strSQLSEL & " AND " & "[" & fldErrorField.Name & "] = " & "#" & strColumnValue & "#" strSQLINS = strSQLINS & " AND " & "[" & fldErrorField.Name & "] = " & "#" & strColumnValue & "#" Else If fldErrorField.Type = dbText Or fldErrorField.Type = dbChar Or fldErrorField.Type = dbMemo Then strSQLSEL = strSQLSEL & " AND " & "[" & fldErrorField.Name & "] = " & "'" & strColumnValue & "'" strSQLINS = strSQLINS & " AND " & "[" & fldErrorField.Name & "] = " & "'" & strColumnValue & "'" Else strSQLSEL = strSQLSEL & " AND " & "[" & fldErrorField.Name & "] = " & strColumnValue strSQLINS = strSQLINS & " AND " & "[" & fldErrorField.Name & "] = " & strColumnValue End If End If End If End If intLoop = (intLoop + 1) ' QJet limitation for maximum conditions is reached. If intLoop = 39 Then Exit For End If Next fldErrorField On Error Resume Next ' Create error table if it does not exist. db.Execute strSQLSEL, dbFailOnError If Err = 3010 Then On Error GoTo ErrorHandler ' Add rows to error table if it already exists. db.Execute strSQLINS, dbFailOnError End If rsErrorTable.Close rsMSysCompactError.MoveNext Wend rsMSysCompactError.Close MsgBox "Done!" Exit Sub ErrorHandler: MsgBox "An error has occurred " & Err & " " & Error Resume Next End Sub The part I am interested in is the ErrorRecid which is the binary bookmark. How can I get the information from that column to see which row had the problem. I have most of it worked out, but that one binary field is giving me fits and I looked everywhere and cannot find. Thank you for the help. Chester
-
I am creating a music database application for personal use. In the database I have a table for the songs and then another table that has who the song maybe a favorit of in my family and the rank they give it from 1 to 3. Now the songs to favorites is many to many. And a song may not be a favorite of anyone or it may be a favorite of everyone. Right now, I am using a listview to display the songs, but I want to implement a table view similar to what Access uses with a row and then a plus(+) sign beside of it to see the child rows. I am wondering how to do this with a listview, or will I need to use a datagrid? Or is there a custom control already out there somewhere? Thank you for the help. Chester
-
Hashing and cryptography issues
cpopham replied to cpopham's topic in Directory / File IO / Registry
Thanks PlausiblyDamp. This is for a larger project that I am wanting to use to learn how to take redirected output from another program as a memorystream and then hash that file stream and encrypt it before writing it out to disk. It is going to be for backup purposes. I am a little weak in hashing and encryption, so I thought that I would start out by learning how the hashing and encryption works with a simple file. Although school has started back now and my course load is still hectic, this has now turned into a weekend project. Thank you for the assist. Chester -
Why can I not get hashing to work
cpopham replied to cpopham's topic in Directory / File IO / Registry
Thanks, PlausiblyDamp. Well, I am trying to figure out hashing and then encryption. The project I am working on will start another application, then redirect its output into a memorystream. I want to hash the data in the memorystream and then encrypt the data before outputting it to disk. I just wanted to be sure that I could get my code working reliably just with hashing and then with cryptography before I use it in the project. Thanks, Chester