
lorena
Avatar/Signature-
Posts
134 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by lorena
-
I am trying to write an application in VB.NET pulls information from an Oracle server and will write it, with other information, to a SQL database. We established a link between the SQL server and the Oracle db and can successfully use "OPENQUERY" to get data from Oracle via SQL. My problem is trying to do the same thing in VB.Net. I get this error: "Could not create an instance of OLE DB provider 'MSDAORA'" I wrote some lines of codes just to test the connection. It bombs out with the error message at the "ExecuteReader" statement Here is my code: (SQL_PROD10 is the linked server name) Imports System.Data Imports System.Data.OleDb Imports System.Data.SqlClient Private Sub continueButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles continueButton.Click Dim connectionString As String connectionString = "Data Source=INTRANET\Server1;Initial Catalog=master;Integrated Security=True" Dim sqlConnection As New SqlClient.SqlConnection(connectionString) Dim sqlCommand As New SqlCommand("select * from openquery (sql_prod10,'Select * from jobno_progno')", sqlConnection) sqlConnection.Open() Dim jobNoReader As SqlDataReader = sqlCommand.ExecuteReader() While jobNoReader.Read Dim jobnostring As String jobnostring = CStr(jobNoReader("JobNo")) Debug.WriteLine("Job No " + jobnostring) End While jobNoReader.Close() End Sub Does anyone have experience with linked servers? I don't and would really appreciate any help! Thanks
-
I wound up fixing the problem. I did a rework on much of the code. Part of my problem was this line: Dim levelDataRow() As DataRow which should have been Dim levelDataRow() As DataRow() If anyone else has encountered a similiar issue, here is my solution. Sub Load_Existing_Record() Dim rrNoString As String Dim recordDataRow As DataRow Dim levelDataRow As DataRow Dim levelDataRows As DataRow() Dim i As Integer Me.RiskReleaseRecordTableAdapter.Fill(Me.RecordAndLevelDataSet.RiskReleaseRecord) Me.RiskReleaseLevelTableAdapter.Fill(Me.RecordAndLevelDataSet.RiskReleaseLevel) Try rrNoString = rrNoComboBox.SelectedValue.ToString recordDataRow = Me.RecordAndLevelDataSet.RiskReleaseRecord.FindByRiskRelNo(rrNoString) levelDataRows = recordDataRow.GetChildRows("RecordToLevelRelation") Me.rrLevelDataGridView.DataSource = levelDataRows Catch ex As Exception MessageBox.Show("The Error is: " & ex.Message.ToString, "ERROR") End Try End Sub
-
I am writing a windows application that interfaces with a SQL database. I want to set up a form that uses data from a parent table (RR_Record) and a child table (RR_Level) based on a value selected by a user from a combobox. The form loads key values for the parent records with no problem. When the user selects one of the choices in the ComboBox, the parent record should populate a series of textboxes on the form and the related child records will be a source for a DataGridView on the form. I created a Data Tier/Data Access Level. Here is the code for that: Public Class RecordAndLevelDataTier 'Class level variables for the DataSet and TableAdapters Private aDataSet As RecordAndLevelDataSet Private aRecordTableAdapter As RecordAndLevelDataSetTableAdapters.RiskReleaseRecordTableAdapter Private aLevelTableAdapter As RecordAndLevelDataSetTableAdapters.RiskReleaseLevelTableAdapter Public Function getRecordAndLevelData() As RecordAndLevelDataSet 'Instantiate the DataSet and TableAdapters aDataSet = New RecordAndLevelDataSet aRecordTableAdapter = New RecordAndLevelDataSetTableAdapters.RR_RecordTableAdapter aLevelTableAdapter = New RecordAndLevelDataSetTableAdapters.RR_LevleTableAdapter 'Fill both of the adapters aRecordTableAdapter.Fill(aDataSet.RR_Record) aLevelTableAdapter.Fill(aDataSet.RR_Level) 'Return the dataset Return aDataSet End Function End Class Here is the code from the windows form: 'Form Level Variables Dim aRiskReleaseData As New RecordAndLevelDataTier Dim aDataSet As RecordAndLevelDataSet Private aBindingSource As BindingSource Private Sub RiskReleaseForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load aDataSet = aRiskReleaseData.getRecordAndLevelData aBindingSource = New BindingSource With aBindingSource .DataSource = aDataSet .DataMember = "RiskReleaseRecord" .Sort = "RiskRelNo" End With With Me.rrNoComboBox .DataSource = aBindingSource .DisplayMember = "RiskRelNo" .ValueMember = "RiskRelNo" .DataBindings.Add("text", aBindingSource, "RiskRelNo", False, DataSourceUpdateMode.Never) .SelectedIndex = 0 End With End Sub 'Here is the combobox code Private Sub rrNoComboBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles rrNoComboBox.SelectedIndexChanged Dim rrNoString As String rrNoString = rrNoComboBox.SelectedValue.ToString 'Dim aDataSet As New DataSet Dim recordDataRow As DataRow recordDataRow = aDataSet.RiskReleaseRecord.FindByRiskRelNo(rrNoString) Dim levelDataRow() As DataRow levelDataRow = recordDataRow.GetChildRows("RecordToLevelRelation") End Sub At this point, I get "Value of type '1-dimensional array of System.Data.DataRow' cannot be converted to 'System.Data.DataRow'" I know I am missing something huge. I guess I feel this is doable, I am just confused as to how to do it. Thanks in advance for any help
-
I have a windows form that interfaces with a sql database. There is a combobox bound to the parent table and when the users selects a record from the combobox, the parent record will load into a series of textboxes and the child records (up to 4 of them) will load into a datagridview. I have a data access layer which loads adapters for the parent and child tables. I have the parent record part figured out but the child rows are a problem. Here is my code and any help would be appreciated: Private Sub rrNoComboBox_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles rrNoComboBox.SelectionChangeCommitted Dim aBindingSource As BindingSource Dim rrNoString As String Dim index As Integer = 0 Dim recordDataRow As DataRow Dim levelDataRow As DataRow '?? rrNoString = rrNoComboBox.SelectedValue.ToString recordDataRow = aRiskReleaseDataSet.RiskReleaseRecord.FindByRiskRelNo(rrNoString) 'This is where I tried to access the child rows and it loads the datagrid but 'only with the fieldnames for the parentrow aBindingSource = New BindingSource Try With rrLevelDataGridView .AutoGenerateColumns = True aBindingSource.DataSource = recordDataRow.GetChildRows(rrNoString) .DataSource = aBindingSource .AllowUserToResizeRows = True .BorderStyle = BorderStyle.Fixed3D End With Catch ex As Exception MessageBox.Show("The Error is: " & ex.Message.ToString) End Try 'This code works to load the parent information With Me .progNoTextBox.Text = recordDataRow!ProgNo.ToString End With End Sub
-
I set up an Oracle sequence to use when I update a database table but I cannot seem to figure out the code access/update it. Does anyone know of any examples of how to do this? Thanks
-
when passed DataRow collection with modified row - this is the error message I am getting when I try to update my datagridview. The form is simple (or so I thought) - I just did the drag and drop and let VS2005 do all the code but when I try to update the datagridview, it deletes the information in the cell and I get the error message. Here is my code: Public Class RiskReleaseUsersForm Private Sub TDS_RR_EMPLOYEEBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TDS_RR_EMPLOYEEBindingNavigatorSaveItem.Click Me.Validate() Me.TDS_RR_EMPLOYEEBindingSource.EndEdit() Me.TDS_RR_EMPLOYEETableAdapter.Update(Me.RiskReleaseEmployeesDataSet.TDS_RR_EMPLOYEE) End Sub Private Sub RiskReleaseUsersForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) _ Handles Me.FormClosing 'Make sure validation events don't keep the form from closing e.Cancel = False 'Show the main menu menuForm.Show() End Sub Private Sub RiskReleaseUsersForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'RiskReleaseEmployeesDataSet.TDS_RR_EMPLOYEE' table. You can move, or remove it, as needed. Me.TDS_RR_EMPLOYEETableAdapter.Fill(Me.RiskReleaseEmployeesDataSet.TDS_RR_EMPLOYEE) End Sub Private Sub ExitToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Me.Close() 'Show the main menu menuForm.Show() End Sub End Class What am I missing?
-
I figured out how to do what I needed to do. Here is the code I used if anyone else runs into this: Private Sub ReleaseReportForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim reportBindingSource As New BindingSource Dim sqlString As String Me.Text = "OPEN REPORTS FOR JOB NO " & menuForm.jobNoString sqlString = "SELECT TDS_RR_RECORD.RR_NO, TDS_RR_RECORD.PROG_NO, TDS_RR_RECORD.JOB_NO, TDS_RR_RECORD.QTY, " & _ " TDS_RR_RECORD.INITIATOR, TDS_RR_RECORD.INITIATOR_DATE, " & _ " TDS_RR_RECORD.CLOSED_DATE, TDS_RR_LEVEL.PART_NO, " & _ " TDS_RR_LEVEL.PART_NAME " & _ " FROM TDS_RR_RECORD INNER JOIN " & _ " TDS_RR_LEVEL ON TDS_RR_RECORD.RR_NO = TDS_RR_LEVEL.RR_NO " & _ " WHERE (TDS_RR_RECORD.STATUS = 'OPEN') AND (TDS_RR_LEVEL.RR_LEVEL = '1') " & _ " AND (TDS_RR_RECORD.JOB_NO='~') " & _ " ORDER BY TDS_RR_RECORD.JOB_NO" sqlString = Replace(sqlString, "~", menuForm.jobNoString) Try With Me.ReleaseDataGridView .AutoGenerateColumns = True reportBindingSource.DataSource = GetData(sqlString) .DataSource = reportBindingSource .AllowUserToResizeColumns = True .BorderStyle = BorderStyle.Fixed3D End With Catch ex As Exception MessageBox.Show("Error is: " & ex.Message.ToString, "ERROR") End Try End Sub Private Shared Function GetData(ByVal sqlCommand As String) _ As DataTable Dim releaseConnectionString As String = My.Settings.ConnectionString Dim releaseConnection As New OracleConnection(riskReleaseConnectionString) Dim releaseCommand As New OracleCommand(sqlCommand, riskReleaseConnection) Dim releaseAdapter As New OracleDataAdapter releaseAdapter.SelectCommand = riskReleaseCommand Dim reportDataTable As New DataTable reportDataTable.Locale = System.Globalization.CultureInfo.InvariantCulture releaseAdapter.Fill(reportDataTable) Return reportDataTable End Function :D
-
I am trying to bind one of two queries to a DataGridView on my windows form. The query pulls in information from two tables (these tables have a master/detail relationship) and I cannot figure out how to make it work. The query will pull in several fields from the master record and several fields from the first associated detail record. Everything I have found is set up for a master/detail situation with the datagridview populated with all the detail records associated with the record from the parent table. I created the query I need and made it part of the dataset but when I try to use that query to bind to the datagridview, it is not one of the choices listed. I hope this is making sense. I am sure there is a way to do this and would appreciate any help.
-
I have a windows application that writes to a .txt file. I would like to give users the opportunity to view the text file while the application is running. Is there a way to do this? I have already set it up so it creates the file, writes to the file and closes the file and that all works fine. I just thought it would be nice to give users the option to view the file and save as or print during the use of the application instead of having to wait until they close the app. Thanks in advance for any help.
-
DataRow - Spaces in Field Name - Problem!!
lorena replied to lorena's topic in Database / XML / Reporting
Thanks very much for your help. Here is the code that worked: .firstNameTextBox.Text = guestDataRow.Item("first name").ToString Thanks for your help! -
I am working on a windows form with a sql database that has several fields that have spaces in their names (NOT my idea or design but there it is). When the form loads, I want to bind the fields from the datarow to the controls on the form. I am running into problems because of the spaces. Here is my code: guestDataRow = aGuestsDataSet.Guests.FindByPhone(phoneString) With Me .firstNameTextBox.Text = guestdatarow!['first name'].tostring .streetTextBox.Text = guestDataRow!street.ToString .cityTextBox.Text = guestDataRow!city.ToString '.lastVisitTextBox.Text = guestDataRow!["last visit date"].ToString End With None of the things I have tried worked and I would appreciate any help. Thanks
-
I will let you know what I find out as I am determined to figure out what the heck the problem is! I am not a network person but it seems to be some kind of issue with IIS since my basic code (other than the database location) has not changed. We have cleared the cache, rebooted the server, set up DisableLazyContentPropagation for each type of ASP, ASP.Net page and now we are back to the proverbial drawing board. I would appreciate any help in this -
-
Thanks for that - I hadn't heard of <body onload> before I also found this code which works pretty well - <%@ OutputCache Location="None" VaryByParam="None" %> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> If the user presses the back button, they still see the webform but it has no information. Then, if they press the forward button, they get "Page Expired" - so it mostly works.
-
This seems to be somehow related to caching on the web server. The new code is not replacing the old code. Any suggestions would be appreciated.
-
I am working on an application that was functioning properly until we re-located the database to a different share on the web server. We had permissions problems right away with the new share and so I kept changing the connectionstring information on my form from the working location to the new location. The databases are Access 97 (ugh) My question is this - the forms (three of them) have totally ceased functioning. They no longer send the email message they did before, nor do they update the database (either database) and there is no error message. Has anyone else ever encountered this problem? I put tons of work into creating these pages and it is very frustrating. We rebooted the web server and it made no difference. I am programming remotely to a network share on the web server so I cannot do any debugging.
-
Thanks so much! I will give that a shot.
-
I have a form and once the user submits it, I have the submit button no longer visible but if the user hits the back button on the browser, the form with all its information is still there. I have tried a variety of things to get the page to expire when the user hits the back button. Right now, the code at the top of the .aspx page looks like this: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="premConv.aspx.vb" Inherits="webforms.premConv"%> <%@ OutputCache Location="None" VaryByParam="None" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Expires" CONTENT="-1"> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> </HEAD> Testing the form, it submits and when I hit the back button on the browser, the original form is there. If I try to hit the forward button, IE tells me the page has expired but I can still hit the back button from there and see the form again. What else do I need to do? Thanks for any help.
-
I have a very long webform to be used for insurance changes. I have a series of radio buttons within each section (Medical, Dental, Life Ins, etc) which users click to indicate which type of change they want to make. With Medical it's no problem, we have one type of Medical and it will be for the employee or employee and family. With Dental, however, I have the radio buttons, two checkboxes and a dropdown. I need to figure out a way to make sure, if the user selected "Add" for the Dental portion, that they also check at least one checkbox and make a selection from the dropdown. I am probably overthinking it, but I am having a problem figuring out how to do this. Here is what I have so far (dentalBoolean is modulelevel): Sub Check_Dental_Choices() Dim dFlag As Boolean 'Check to see if any Dental selections have been made If noDentalRadiobutton.Checked = False Then If (empDentalCheckBox.Checked = True Or depDentalCheckBox.Checked = True) _ And dentalDropDownList.SelectedValue <> "Coverage Type" Then dentalBoolean = True Else dFlag = False End If Else 'If this NoDental is the choice, all other choices are 'disregarded and dentalBoolean is set to false dentalBoolean = False End If End Sub Is there a way to use Try/Catch here? I want the form to cease processing if the user choices aren't correct. sorry to be so wordy. thanks in advance.
-
Thanks. I will try that.
-
VS 2005 Connect to Oracle 10g NEW POST
lorena replied to lorena's topic in Database / XML / Reporting
Thanks for the information. Yes, I am sure the servername is correct. It looks like my connection string is the same. -
I downloaded and installed the Oracle ODP for .NET and then added a reference to Oracle Data Access in my project references. I tried setting a connection using a datagridview control and got an error. So I put the connection information in the form load event just to see where it fails and I get the same error when the application tries to open the connection: "ORA-12154: TNS could not resolve the connect identifier specified" Here is my code: Imports Oracle.DataAccess.Client Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim conn As New OracleConnection conn.ConnectionString = "Password=password;User ID=username;Data Source=servername;Persist Security Info=True" conn.Open() Console.Write("Connection Opened") conn.Close() conn.Dispose() End Sub [code=visualbasic] Has anyone used the Oracle ODP successfully? I really need help with this and am just not sure where to go.
-
I have started doing a new project and I need to connect to our production database which is Oracle 10g. I have been trying to find information on it with little success. When I try to add a data source, the Oracle connection only goes up to 9i and I tried using ODBC/dsn without success. I would be happy for any help or advice.
-
Well, this is really bizarre. I started by commenting all the code out and adding it back a line at a time, changing nothing and now it works! *argh* thanks for your help though. I just wish I knew why it works now.
-
I can't run the debugger. I am doing development on a remote server and have never been able to get the debugger to work
-
The page builds with no errors. The error occurs when I try to preview the page in a browser window. Here is the stack trace: NullReferenceException: Object reference not set to an instance of an object.] webforms.oe_test.BindData() in J:\WebForms\oe\oe_test.aspx.vb:50 webforms.oe_test.Page_Load(Object sender, EventArgs e) in J:\WebForms\oe\oe_test.aspx.vb:32 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +750 Line 50 is grdRecs.DataSource = objDS I checked my query and, in the access database, it pulls the data in correctly but it looks like the dataset is null if I am reading it right.