18. juni 2006 - 21:07
Der er
2 kommentarer og 1 løsning
Visual Studio - hente data i accessdatabase
Jeg får følgende fejlmeddelser, når jeg forsøger at oprette forbindelse til en accessdatabase i en DataGridView: 1) 'Faktureringssystem.Faktureringssystem.fakturasystemDataSet' is a 'field' bus is used like a 'type' 2) The type name 'fakutrasystemDataSetTableAdapter' does not exist in the type 'Faktureringssystem.Faktureringssystem' Kodelinierne for de to ser ud som følgende: 1) this.fakturasystemDataSet = new Faktureringssystem.fakturasystemDataSet(); 2) this.kunderTableAdapter = new Faktureringssystem.fakturasystemDataSetTableAdapters.KunderTableAdapter(); Kan I fortælle mig, hvorfor jeg får følgende fejl? mvh simsen
Annonceindlæg fra Conscia
Hejsa Arne Jeg undrer mig bare, fordi jeg har ikke kodet én linie selv endnu. Jeg forsøger at bruge VS' indbyggede system. Derfor kopierer jeg også lige Designer.cs koden ind. Har du brug for at vide, hvordan jeg forsøger at tilgå det skridt for skridt, skal du bare sige til, så laver jeg den en gang til, og skriver ned, hvad det er jeg gør. Faktureringssystem.cs kode: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.OleDb; namespace Faktureringssystem { public partial class Faktureringssystem : Form { public Faktureringssystem() { InitializeComponent(); } private void Faktureringssystem_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'fakturasystemDataSet.Kunder' table. You can move, or remove it, as needed. this.kunderTableAdapter.Fill(this.fakturasystemDataSet.Kunder); } } } Faktureringssystem.Designer.cs kode: namespace Faktureringssystem { partial class Faktureringssystem { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.fakturasystemDataSet = new Faktureringssystem.fakturasystemDataSet(); this.kunderBindingSource = new System.Windows.Forms.BindingSource(this.components); this.kunderTableAdapter = new Faktureringssystem.fakturasystemDataSetTableAdapters.KunderTableAdapter(); this.kundeIdDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.navnDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.adresseDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.postnrDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.byDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.telefonnrDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.mobilnrDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.epostadresseDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.noterDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.fakturasystemDataSet)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.kunderBindingSource)).BeginInit(); this.SuspendLayout(); // // tabControl1 // this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Location = new System.Drawing.Point(-2, -2); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(940, 557); this.tabControl1.TabIndex = 0; // // tabPage1 // this.tabPage1.BackgroundImage = global::Faktureringssystem.Properties.Resources.bluecity; this.tabPage1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.tabPage1.Controls.Add(this.dataGridView1); this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(932, 531); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "tabPage1"; this.tabPage1.UseVisualStyleBackColor = true; // // tabPage2 // this.tabPage2.BackgroundImage = global::Faktureringssystem.Properties.Resources.bluecity; this.tabPage2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Size = new System.Drawing.Size(932, 531); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "tabPage2"; this.tabPage2.UseVisualStyleBackColor = true; // // dataGridView1 // this.dataGridView1.AutoGenerateColumns = false; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.kundeIdDataGridViewTextBoxColumn, this.navnDataGridViewTextBoxColumn, this.adresseDataGridViewTextBoxColumn, this.postnrDataGridViewTextBoxColumn, this.byDataGridViewTextBoxColumn, this.telefonnrDataGridViewTextBoxColumn, this.mobilnrDataGridViewTextBoxColumn, this.epostadresseDataGridViewTextBoxColumn, this.noterDataGridViewTextBoxColumn}); this.dataGridView1.DataSource = this.kunderBindingSource; this.dataGridView1.Location = new System.Drawing.Point(107, 138); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Size = new System.Drawing.Size(727, 150); this.dataGridView1.TabIndex = 0; // // fakturasystemDataSet // this.fakturasystemDataSet.DataSetName = "fakturasystemDataSet"; this.fakturasystemDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // kunderBindingSource // this.kunderBindingSource.DataMember = "Kunder"; this.kunderBindingSource.DataSource = this.fakturasystemDataSet; // // kunderTableAdapter // this.kunderTableAdapter.ClearBeforeFill = true; // // kundeIdDataGridViewTextBoxColumn // this.kundeIdDataGridViewTextBoxColumn.DataPropertyName = "KundeId"; this.kundeIdDataGridViewTextBoxColumn.HeaderText = "KundeId"; this.kundeIdDataGridViewTextBoxColumn.Name = "kundeIdDataGridViewTextBoxColumn"; // // navnDataGridViewTextBoxColumn // this.navnDataGridViewTextBoxColumn.DataPropertyName = "Navn"; this.navnDataGridViewTextBoxColumn.HeaderText = "Navn"; this.navnDataGridViewTextBoxColumn.Name = "navnDataGridViewTextBoxColumn"; // // adresseDataGridViewTextBoxColumn // this.adresseDataGridViewTextBoxColumn.DataPropertyName = "Adresse"; this.adresseDataGridViewTextBoxColumn.HeaderText = "Adresse"; this.adresseDataGridViewTextBoxColumn.Name = "adresseDataGridViewTextBoxColumn"; // // postnrDataGridViewTextBoxColumn // this.postnrDataGridViewTextBoxColumn.DataPropertyName = "Postnr"; this.postnrDataGridViewTextBoxColumn.HeaderText = "Postnr"; this.postnrDataGridViewTextBoxColumn.Name = "postnrDataGridViewTextBoxColumn"; // // byDataGridViewTextBoxColumn // this.byDataGridViewTextBoxColumn.DataPropertyName = "By"; this.byDataGridViewTextBoxColumn.HeaderText = "By"; this.byDataGridViewTextBoxColumn.Name = "byDataGridViewTextBoxColumn"; // // telefonnrDataGridViewTextBoxColumn // this.telefonnrDataGridViewTextBoxColumn.DataPropertyName = "Telefonnr"; this.telefonnrDataGridViewTextBoxColumn.HeaderText = "Telefonnr"; this.telefonnrDataGridViewTextBoxColumn.Name = "telefonnrDataGridViewTextBoxColumn"; // // mobilnrDataGridViewTextBoxColumn // this.mobilnrDataGridViewTextBoxColumn.DataPropertyName = "Mobilnr"; this.mobilnrDataGridViewTextBoxColumn.HeaderText = "Mobilnr"; this.mobilnrDataGridViewTextBoxColumn.Name = "mobilnrDataGridViewTextBoxColumn"; // // epostadresseDataGridViewTextBoxColumn // this.epostadresseDataGridViewTextBoxColumn.DataPropertyName = "E-post-adresse"; this.epostadresseDataGridViewTextBoxColumn.HeaderText = "E-post-adresse"; this.epostadresseDataGridViewTextBoxColumn.Name = "epostadresseDataGridViewTextBoxColumn"; // // noterDataGridViewTextBoxColumn // this.noterDataGridViewTextBoxColumn.DataPropertyName = "Noter"; this.noterDataGridViewTextBoxColumn.HeaderText = "Noter"; this.noterDataGridViewTextBoxColumn.Name = "noterDataGridViewTextBoxColumn"; // // Faktureringssystem // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(933, 549); this.Controls.Add(this.tabControl1); this.Name = "Faktureringssystem"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Hannes faktureringssystem"; this.TopMost = true; this.Load += new System.EventHandler(this.Faktureringssystem_Load); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.fakturasystemDataSet)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.kunderBindingSource)).EndInit(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.DataGridView dataGridView1; private fakturasystemDataSet fakturasystemDataSet; private System.Windows.Forms.BindingSource kunderBindingSource; private global::Faktureringssystem.fakturasystemDataSetTableAdapters.KunderTableAdapter kunderTableAdapter; private System.Windows.Forms.DataGridViewTextBoxColumn kundeIdDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn navnDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn adresseDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn postnrDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn byDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn telefonnrDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn mobilnrDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn epostadresseDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn noterDataGridViewTextBoxColumn; } }