Jump to content
Xtreme .Net Talk

tate

Avatar/Signature
  • Posts

    116
  • Joined

  • Last visited

Everything posted by tate

  1. Is there a way to add information from an XML file into the repeater control's HeaderTemplate? I have no problem displaying XML information in the ItemTemplate but I receive the following exception when I place data in the HeaderTemplate. "Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: container" ~~~~~~~~~~~~~~~~~~~~~ Code ~~~~~~~~~~~~~~~~~~~~~~ <asp:Repeater id="rpSeries" DataSourceID="XmlDataSource1" runat="server"> <HeaderTemplate> <font size="+1"><strong>Current Sermon Series: <br /><br /> <%#XPath("Title")%> </strong></font> </HeaderTemplate> <ItemTemplate> <div class="content"> <br /><br /> <Strong><%#XPath("Date")%> <%#XPath("Sermon")%> <br /> </Strong> <%#XPath("Scripture")%> <br /><br /> <%#XPath("Text")%> <br /> </div> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:Repeater>
  2. Try a connection string similar to; "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/??path??/database.mdb") & ";User ID=Admin"
  3. Sounds like your connection string is not correct somewhere. Would you mind posting it? Tate
  4. Read about using hash data.
  5. I finally figured it out so the code is posted below for all to see how you can use parameterized queries in MS Access. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then ' Create data adapter and dataset for ddlStudy then fill Dim daStudyList As New OleDbDataAdapter("SELECT StudyID, Study FROM tblStudy", conSmallGrp) Dim dsStudyList As New DataSet Try ' Open connection conSmallGrp.Open() ' Fill dataset used to populate ddlStudy daStudyList.Fill(dsStudyList, "tblStudyList") ' Populate ddlStudy ddlStudy.DataSource = dsStudyList.Tables("tblStudyList") ddlStudy.DataValueField = "StudyID" ddlStudy.DataTextField = "Study" ddlStudy.DataBind() ' If there is data fill text boxes If dsStudyList.Tables("tblStudyList").Rows.Count > 0 Then Me.ShowStudy(ddlStudy.SelectedItem.Value) End If Catch ex As Exception lblTest.Text = ex.Message Finally conSmallGrp.Close() End Try End If End Sub Private Sub ShowStudy(ByVal StudyID As Integer) ' Create data adapter and dataset for text boxes then fill the dataset Dim daStudy As New OleDbDataAdapter("SELECT * FROM tblStudy WHERE StudyID = @StudyID", conSmallGrp) Dim dsStudy As New DataSet daStudy.SelectCommand.Parameters.Add("@StudyID", OleDbType.Integer) daStudy.SelectCommand.Parameters("@StudyID").Value = StudyID ' Fill dataset that will be used to populate text boxes daStudy.Fill(dsStudy, "tblStudy") txtStudyID.Text = CStr(dsStudy.Tables("tblStudy").Rows(0).Item("StudyID")) txtCategory.Text = CStr(dsStudy.Tables("tblStudy").Rows(0).Item("CategoryID")) txtBookTitle.Text = dsStudy.Tables("tblStudy").Rows(0).Item("Book") txtAuthor.Text = dsStudy.Tables("tblStudy").Rows(0).Item("Author") txtISBN.Text = dsStudy.Tables("tblStudy").Rows(0).Item("Isbn") txtSummary.Text = dsStudy.Tables("tblStudy").Rows(0).Item("Summary") End Sub
  6. Thank you for your reply. However, after making the change you requested I now receive the following error; "Specified cast is not valid" Which looks to be in the positive direction but now it appears their is a problem with the MS Access data type for the index value. I thought the auto-number field would be an integer. By the way, this is the same error received if I use the original code presented with 1 change; daStudy.SelectCommand.Parameters.Add("@StudyID") changed to daStudy.SelectCommand.Parameters.Add("@StudyID", OleDbType.Integer)
  7. I'm having a problem using a parameter as part of the SELECT statement. Can someone please help me to understand why I get the following error; "The OleDbParameterCollection only accepts non-null OleDbParameter type objects, not String objects" Thanks in advance for the help. *********** Here is the code ******************************* Dim daStudy As New OleDbDataAdapter("SELECT * FROM tblStudy WHERE StudyID = @StudyID", conSmallGrp) Dim dsStudy As New DataSet Me.ShowStudy(ddlStudy.SelectedItem.Value) Private Sub ShowStudy(ByVal StudyID As Integer) daStudy.SelectCommand.Parameters.Add("@StudyID") daStudy.SelectCommand.Parameters("@StudyID").Value = StudyID ' Fill dataset that will be used to populate text boxes daStudy.Fill(dsStudy, "tblStudy") txtStudyID = dsStudy.Tables("tblStudy").Rows(0).Item("StudyID") txtCategory = dsStudy.Tables("tblStudy").Rows(0).Item("CategoryID") txtBookTitle = dsStudy.Tables("tblStudy").Rows(0).Item("Book") txtAuthor = dsStudy.Tables("tblStudy").Rows(0).Item("Author") txtISBN = dsStudy.Tables("tblStudy").Rows(0).Item("Isbn") txtSummary = dsStudy.Tables("tblStudy").Rows(0).Item("Summary") End Sub
  8. Why can't you display everything in your dropdown list? As long as the associated data is in the same database table record you can concatenate the data together and use the new text string to populate the dropdown list.
  9. I'm aware of that. However, that doesn't explain how to use JavaScript to determine the codebehind page to follow.
  10. Is it possible to use a JavaScript confirm dialog box to determine if some codebehind will be processed? Prior to deleting a record from a database I would like to prompt the user to confirm their intent and include the particular database record information in a message box. If they select "OK" then the codebehind function is processed. If they select "NO" then they are returned back to the originating web form.
  11. Will the number of the records to filter for change? If so, you may look at the possibility of using parameters as part of your SQL filter (WHERE) statement that is used to fill your dataset.
  12. After way too many hours I have been able to get the code to work. The problem was with a combination of things; 1. Dropdown list value needed to use Test property instead of Value 2. Checkbox field (boolean field) didn't need quotes surrounding it in the SQL 3. CDate conversion of time fields didn't work for Access ShortTime, so forced the value CODE: Dim strChildcare As String If chkYes.Checked Then strChildcare = "True" ElseIf chkNo.Checked Then strChildcare = "False" Else strChildcare = "False" End If Dim datToday As DateTime Dim datEventDate As DateTime Dim strStart As String Dim strEnd As String Dim strListItem As String strListItem = lstLocation.SelectedItem.Text datToday = DateTime.Today datEventDate = CDate(txtDate.Text) strStart = txtStartHr.Text + ":" + txtStartMin.Text strEnd = txtEndHr.Text + ":" + txtEndMin.Text Dim strCmd As String strCmd = "INSERT INTO tblEvent (AdminName, AdminDate, Event, EventDate, StartTime, EndTime, Location, Childcare, AddDetail) VALUES ('" & strAdmin & "', " & DateTime.Today & ", '" & txtEvent.Text & "', #" & txtDate.Text & "#, #" & strStart & "#, #" & strEnd & "#, '" & strListItem & "', " & strChildcare & ", '" & txtComments.Text & "')"
  13. Is there a reason why you can't use the PageLoad event?
  14. What is the purpose of the RedirectPage string variable? I don't see it referenced in the code anywhere? Normally I use the RedirectPage that is part of the Authentication object.
  15. How about using the dropdown list selected item change event to save the item's value property to a value in session state? I believe this will work for any user control as long as it looks for the value.
  16. Don't you have to use a tag defining the response.write as a JavaScript message? If you are using ASP.NET just use a label and assign the text property during the page loade event.
  17. I have tried the following with no luck; VALUES ('" & strAdmin & "', #" & datToday & "#, '" & txtEvent.Text & "', #" & datEventDate & "#, #" & datStart & "#, #" & datEnd & "#, '" & lstLocation.SelectedValue & "', '" & strChildcare & "', '" & txtComments.Text & "')"
  18. The CDate(txtDate.Text) conversion will result in 4/9/2005. Based on the error it looks like something is wrong with the two time values (datStart and datEnd) not the date field. Thanks again for your suggestions.
  19. The format within the Access table for the date fields is mm/dd/yyyy and the time fields were set to ShortTime. Yet, I receive the error?
  20. Ok, I'm really tired banging my head on the monitor over the correct syntax for this one. I'm trying to add a record to an Access database and I receive the following error; Syntax error (missing operator) in query expression '8:00:00 AM'. Here is the associated SQL statement I'm using; datEventDate = CDate(txtDate.Text) datStart = CDate(txtStart.Text) datEnd = CDate(txtEnd.Text) datToday = DateTime.Today Dim strCmd As String strCmd = "INSERT INTO tblEvent (AdminName, AdminDate, Event, EventDate, StartTime, EndTime, Location, Childcare, AddDetail) VALUES ('" & strAdmin & "', " & datToday & ", '" & txtEvent.Text & "', " & datEventDate & ", " & datStart & ", " & datEnd & ", '" & lstLocation.SelectedValue & "', '" & strChildcare & "', '" & txtComments.Text & "')" Here is the data I'm attempting to add; AdminName = determined in application AdminDate = determined in application Event = Test event EventDate = 04/09/2005 StartTime = 08:00 EndTime = 21:00 Location = Other Childcare = False AddDetail = Its my birthday Thanks for taking the time to help. Tate
  21. If you want to take care of this on the client then I'd scrap the idea about using the ASP.NET calendar. Instead, I would play around with creating the calendar using JavaScript such that each day is rendered as a hyperlink. However, the hyperlink would be dead except to trigger a click event that calls a function which populates your text box. I don't have the code to accomplish this but I'd start by learning to create the JavaScript calendar. Then play around with the document.write string to generate the hyperlink. Here is a URL that lists all kinds of JavaScript calendars to get you started. http://www.jsmadeeasy.com/javascripts/Calendars/list_test.asp Good luck and let me know if you accomplish it. Tate
  22. What are you actually trying to accomplish?
  23. Thanks for the link it looks like a pretty neat item to have in the tool box.
  24. Why don't you want to use a text box?
  25. This doesn't seam to be feasible to me considering the security implications.
×
×
  • Create New...