[MySQL Student App] Legg til en del funksjoner og shit
This commit is contained in:
parent
ef4dee2f4c
commit
a82ba61675
@ -1,4 +1,4 @@
|
|||||||
CREATE DATABASE IF NOT EXISTS `books` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */;
|
CREATE DATABASE IF NOT EXISTS `books` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
|
||||||
USE `books`;
|
USE `books`;
|
||||||
-- MySQL dump 10.13 Distrib 8.0.15, for Win64 (x86_64)
|
-- MySQL dump 10.13 Distrib 8.0.15, for Win64 (x86_64)
|
||||||
--
|
--
|
||||||
@ -30,7 +30,7 @@ CREATE TABLE `books` (
|
|||||||
`BookAuthor` varchar(45) DEFAULT NULL,
|
`BookAuthor` varchar(45) DEFAULT NULL,
|
||||||
`BookDescription` varchar(255) DEFAULT NULL,
|
`BookDescription` varchar(255) DEFAULT NULL,
|
||||||
PRIMARY KEY (`BookId`)
|
PRIMARY KEY (`BookId`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -56,7 +56,7 @@ UNLOCK TABLES;
|
|||||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||||
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
@ -91,7 +91,7 @@ DELIMITER ;
|
|||||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||||
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
@ -112,7 +112,7 @@ DELIMITER ;
|
|||||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||||
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
@ -137,7 +137,7 @@ DELIMITER ;
|
|||||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||||
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
@ -156,7 +156,7 @@ DELIMITER ;
|
|||||||
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
|
||||||
/*!50003 SET character_set_client = utf8mb4 */ ;
|
/*!50003 SET character_set_client = utf8mb4 */ ;
|
||||||
/*!50003 SET character_set_results = utf8mb4 */ ;
|
/*!50003 SET character_set_results = utf8mb4 */ ;
|
||||||
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
|
/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;
|
||||||
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
|
||||||
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
|
||||||
DELIMITER ;;
|
DELIMITER ;;
|
||||||
|
@ -170,6 +170,7 @@
|
|||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.Name = "BookSearchApp";
|
this.Name = "BookSearchApp";
|
||||||
this.Text = "Book Search App";
|
this.Text = "Book Search App";
|
||||||
|
this.Load += new System.EventHandler(this.BookSearchApp_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridTableData)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridTableData)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
@ -134,5 +134,10 @@ namespace MySQLBookAppCRUD
|
|||||||
{
|
{
|
||||||
ClearFields();
|
ClearFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BookSearchApp_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
MySQLStoredProcedureStudent/Icon.ico
Normal file
BIN
MySQLStoredProcedureStudent/Icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
25
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent.sln
Normal file
25
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.28307.489
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySQLStoredProcedureStudent", "MySQLStoredProcedureStudent\MySQLStoredProcedureStudent.csproj", "{093C0E9F-15C3-45A9-8FFA-F0FE81C19E8E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{093C0E9F-15C3-45A9-8FFA-F0FE81C19E8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{093C0E9F-15C3-45A9-8FFA-F0FE81C19E8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{093C0E9F-15C3-45A9-8FFA-F0FE81C19E8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{093C0E9F-15C3-45A9-8FFA-F0FE81C19E8E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {8DE18350-AD6E-46E1-A452-00E8AF1C2559}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
BIN
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/Icon.ico
Normal file
BIN
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/Icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
@ -0,0 +1,103 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{093C0E9F-15C3-45A9-8FFA-F0FE81C19E8E}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>MySQLStoredProcedureStudent</RootNamespace>
|
||||||
|
<AssemblyName>MySQLStoredProcedureStudent</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="MySql.Data, Version=8.0.15.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\MySql.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Poststed.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Poststed.Designer.cs">
|
||||||
|
<DependentUpon>Poststed.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="PoststedItem.cs" />
|
||||||
|
<Compile Include="StudentForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="StudentForm.Designer.cs">
|
||||||
|
<DependentUpon>StudentForm.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<EmbeddedResource Include="Poststed.resx">
|
||||||
|
<DependentUpon>Poststed.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="StudentForm.resx">
|
||||||
|
<DependentUpon>StudentForm.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Icon.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
121
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/Poststed.Designer.cs
generated
Normal file
121
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/Poststed.Designer.cs
generated
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
namespace MySQLStoredProcedureStudent
|
||||||
|
{
|
||||||
|
partial class Poststed
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Poststed));
|
||||||
|
this.btnPoststedAdd = new System.Windows.Forms.Button();
|
||||||
|
this.lblPostnummer = new System.Windows.Forms.Label();
|
||||||
|
this.txtPostnummer = new System.Windows.Forms.TextBox();
|
||||||
|
this.gridPoststedList = new System.Windows.Forms.DataGridView();
|
||||||
|
this.txtPoststed = new System.Windows.Forms.TextBox();
|
||||||
|
this.lblPoststed = new System.Windows.Forms.Label();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridPoststedList)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// btnPoststedAdd
|
||||||
|
//
|
||||||
|
this.btnPoststedAdd.Location = new System.Drawing.Point(81, 227);
|
||||||
|
this.btnPoststedAdd.Name = "btnPoststedAdd";
|
||||||
|
this.btnPoststedAdd.Size = new System.Drawing.Size(166, 23);
|
||||||
|
this.btnPoststedAdd.TabIndex = 14;
|
||||||
|
this.btnPoststedAdd.Text = "Legg til poststed";
|
||||||
|
this.btnPoststedAdd.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// lblPostnummer
|
||||||
|
//
|
||||||
|
this.lblPostnummer.AutoSize = true;
|
||||||
|
this.lblPostnummer.Location = new System.Drawing.Point(7, 166);
|
||||||
|
this.lblPostnummer.Name = "lblPostnummer";
|
||||||
|
this.lblPostnummer.Size = new System.Drawing.Size(68, 13);
|
||||||
|
this.lblPostnummer.TabIndex = 13;
|
||||||
|
this.lblPostnummer.Text = "Postnummer:";
|
||||||
|
//
|
||||||
|
// txtPostnummer
|
||||||
|
//
|
||||||
|
this.txtPostnummer.Location = new System.Drawing.Point(81, 163);
|
||||||
|
this.txtPostnummer.Name = "txtPostnummer";
|
||||||
|
this.txtPostnummer.Size = new System.Drawing.Size(166, 20);
|
||||||
|
this.txtPostnummer.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// gridPoststedList
|
||||||
|
//
|
||||||
|
this.gridPoststedList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.gridPoststedList.Location = new System.Drawing.Point(253, 12);
|
||||||
|
this.gridPoststedList.Name = "gridPoststedList";
|
||||||
|
this.gridPoststedList.Size = new System.Drawing.Size(535, 426);
|
||||||
|
this.gridPoststedList.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// txtPoststed
|
||||||
|
//
|
||||||
|
this.txtPoststed.Location = new System.Drawing.Point(81, 189);
|
||||||
|
this.txtPoststed.Name = "txtPoststed";
|
||||||
|
this.txtPoststed.Size = new System.Drawing.Size(166, 20);
|
||||||
|
this.txtPoststed.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// lblPoststed
|
||||||
|
//
|
||||||
|
this.lblPoststed.AutoSize = true;
|
||||||
|
this.lblPoststed.Location = new System.Drawing.Point(7, 192);
|
||||||
|
this.lblPoststed.Name = "lblPoststed";
|
||||||
|
this.lblPoststed.Size = new System.Drawing.Size(51, 13);
|
||||||
|
this.lblPoststed.TabIndex = 9;
|
||||||
|
this.lblPoststed.Text = "Poststed:";
|
||||||
|
//
|
||||||
|
// Poststed
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.btnPoststedAdd);
|
||||||
|
this.Controls.Add(this.lblPostnummer);
|
||||||
|
this.Controls.Add(this.txtPostnummer);
|
||||||
|
this.Controls.Add(this.gridPoststedList);
|
||||||
|
this.Controls.Add(this.txtPoststed);
|
||||||
|
this.Controls.Add(this.lblPoststed);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.Name = "Poststed";
|
||||||
|
this.Text = "Poststed";
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridPoststedList)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button btnPoststedAdd;
|
||||||
|
private System.Windows.Forms.Label lblPostnummer;
|
||||||
|
private System.Windows.Forms.TextBox txtPostnummer;
|
||||||
|
private System.Windows.Forms.DataGridView gridPoststedList;
|
||||||
|
private System.Windows.Forms.TextBox txtPoststed;
|
||||||
|
private System.Windows.Forms.Label lblPoststed;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
|
namespace MySQLStoredProcedureStudent
|
||||||
|
{
|
||||||
|
public partial class Poststed : Form
|
||||||
|
{
|
||||||
|
private MySqlConnection _connection = null;
|
||||||
|
// So that I can call public methods inside the "parent" form.
|
||||||
|
private StudentForm _parentForm = null;
|
||||||
|
|
||||||
|
public Poststed(MySqlConnection connection, StudentForm parentForm)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
_connection = connection;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MySQLStoredProcedureStudent
|
||||||
|
{
|
||||||
|
public class PoststedItem
|
||||||
|
{
|
||||||
|
public string Poststed { get; set; }
|
||||||
|
public string Postnummer { get; set; }
|
||||||
|
|
||||||
|
public PoststedItem(string postnummer, string poststed)
|
||||||
|
{
|
||||||
|
Postnummer = postnummer;
|
||||||
|
Poststed = poststed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"{Postnummer} {Poststed}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace MySQLStoredProcedureStudent
|
||||||
|
{
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new StudentForm());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("MySQLStoredProcedureStudent")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("MySQLStoredProcedureStudent")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("093c0e9f-15c3-45a9-8ffa-f0fe81c19e8e")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/Properties/Resources.Designer.cs
generated
Normal file
71
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace MySQLStoredProcedureStudent.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MySQLStoredProcedureStudent.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
30
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/Properties/Settings.Designer.cs
generated
Normal file
30
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace MySQLStoredProcedureStudent.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
329
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/StudentForm.Designer.cs
generated
Normal file
329
MySQLStoredProcedureStudent/MySQLStoredProcedureStudent/StudentForm.Designer.cs
generated
Normal file
@ -0,0 +1,329 @@
|
|||||||
|
namespace MySQLStoredProcedureStudent
|
||||||
|
{
|
||||||
|
partial class StudentForm
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StudentForm));
|
||||||
|
this.gridStudentList = new System.Windows.Forms.DataGridView();
|
||||||
|
this.txtStudentSearch = new System.Windows.Forms.TextBox();
|
||||||
|
this.lblSearchStudent = new System.Windows.Forms.Label();
|
||||||
|
this.btnSearchStudent = new System.Windows.Forms.Button();
|
||||||
|
this.btnSaveStudent = new System.Windows.Forms.Button();
|
||||||
|
this.btnDeleteStudent = new System.Windows.Forms.Button();
|
||||||
|
this.btnCancelStudent = new System.Windows.Forms.Button();
|
||||||
|
this.txtFirstName = new System.Windows.Forms.TextBox();
|
||||||
|
this.txtLastName = new System.Windows.Forms.TextBox();
|
||||||
|
this.txtAddress = new System.Windows.Forms.TextBox();
|
||||||
|
this.txtPhone = new System.Windows.Forms.TextBox();
|
||||||
|
this.lblFirstName = new System.Windows.Forms.Label();
|
||||||
|
this.lblLastName = new System.Windows.Forms.Label();
|
||||||
|
this.lblAddress = new System.Windows.Forms.Label();
|
||||||
|
this.lblPoststed = new System.Windows.Forms.Label();
|
||||||
|
this.lblPhone = new System.Windows.Forms.Label();
|
||||||
|
this.lblAge = new System.Windows.Forms.Label();
|
||||||
|
this.btnOpenPoststed = new System.Windows.Forms.Button();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||||
|
this.numAge = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.listPoststed = new System.Windows.Forms.ComboBox();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridStudentList)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numAge)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// gridStudentList
|
||||||
|
//
|
||||||
|
this.gridStudentList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
this.gridStudentList.Location = new System.Drawing.Point(426, 41);
|
||||||
|
this.gridStudentList.Name = "gridStudentList";
|
||||||
|
this.gridStudentList.Size = new System.Drawing.Size(892, 520);
|
||||||
|
this.gridStudentList.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// txtStudentSearch
|
||||||
|
//
|
||||||
|
this.txtStudentSearch.Location = new System.Drawing.Point(458, 14);
|
||||||
|
this.txtStudentSearch.Name = "txtStudentSearch";
|
||||||
|
this.txtStudentSearch.Size = new System.Drawing.Size(668, 20);
|
||||||
|
this.txtStudentSearch.TabIndex = 12;
|
||||||
|
//
|
||||||
|
// lblSearchStudent
|
||||||
|
//
|
||||||
|
this.lblSearchStudent.AutoSize = true;
|
||||||
|
this.lblSearchStudent.Location = new System.Drawing.Point(423, 17);
|
||||||
|
this.lblSearchStudent.Name = "lblSearchStudent";
|
||||||
|
this.lblSearchStudent.Size = new System.Drawing.Size(29, 13);
|
||||||
|
this.lblSearchStudent.TabIndex = 7;
|
||||||
|
this.lblSearchStudent.Text = "Søk:";
|
||||||
|
//
|
||||||
|
// btnSearchStudent
|
||||||
|
//
|
||||||
|
this.btnSearchStudent.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.btnSearchStudent.Location = new System.Drawing.Point(1132, 11);
|
||||||
|
this.btnSearchStudent.Name = "btnSearchStudent";
|
||||||
|
this.btnSearchStudent.Size = new System.Drawing.Size(186, 23);
|
||||||
|
this.btnSearchStudent.TabIndex = 13;
|
||||||
|
this.btnSearchStudent.Text = "Søk";
|
||||||
|
this.btnSearchStudent.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btnSaveStudent
|
||||||
|
//
|
||||||
|
this.btnSaveStudent.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.btnSaveStudent.Location = new System.Drawing.Point(12, 283);
|
||||||
|
this.btnSaveStudent.Name = "btnSaveStudent";
|
||||||
|
this.btnSaveStudent.Size = new System.Drawing.Size(119, 23);
|
||||||
|
this.btnSaveStudent.TabIndex = 9;
|
||||||
|
this.btnSaveStudent.Text = "Lagre";
|
||||||
|
this.btnSaveStudent.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btnDeleteStudent
|
||||||
|
//
|
||||||
|
this.btnDeleteStudent.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.btnDeleteStudent.Location = new System.Drawing.Point(137, 283);
|
||||||
|
this.btnDeleteStudent.Name = "btnDeleteStudent";
|
||||||
|
this.btnDeleteStudent.Size = new System.Drawing.Size(86, 23);
|
||||||
|
this.btnDeleteStudent.TabIndex = 10;
|
||||||
|
this.btnDeleteStudent.Text = "Slett";
|
||||||
|
this.btnDeleteStudent.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// btnCancelStudent
|
||||||
|
//
|
||||||
|
this.btnCancelStudent.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.btnCancelStudent.Location = new System.Drawing.Point(229, 283);
|
||||||
|
this.btnCancelStudent.Name = "btnCancelStudent";
|
||||||
|
this.btnCancelStudent.Size = new System.Drawing.Size(191, 23);
|
||||||
|
this.btnCancelStudent.TabIndex = 11;
|
||||||
|
this.btnCancelStudent.Text = "Avbryt";
|
||||||
|
this.btnCancelStudent.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// txtFirstName
|
||||||
|
//
|
||||||
|
this.txtFirstName.Location = new System.Drawing.Point(104, 41);
|
||||||
|
this.txtFirstName.Name = "txtFirstName";
|
||||||
|
this.txtFirstName.Size = new System.Drawing.Size(316, 20);
|
||||||
|
this.txtFirstName.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// txtLastName
|
||||||
|
//
|
||||||
|
this.txtLastName.Location = new System.Drawing.Point(104, 67);
|
||||||
|
this.txtLastName.Name = "txtLastName";
|
||||||
|
this.txtLastName.Size = new System.Drawing.Size(316, 20);
|
||||||
|
this.txtLastName.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// txtAddress
|
||||||
|
//
|
||||||
|
this.txtAddress.Location = new System.Drawing.Point(104, 93);
|
||||||
|
this.txtAddress.Name = "txtAddress";
|
||||||
|
this.txtAddress.Size = new System.Drawing.Size(316, 20);
|
||||||
|
this.txtAddress.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// txtPhone
|
||||||
|
//
|
||||||
|
this.txtPhone.Location = new System.Drawing.Point(104, 145);
|
||||||
|
this.txtPhone.Name = "txtPhone";
|
||||||
|
this.txtPhone.Size = new System.Drawing.Size(316, 20);
|
||||||
|
this.txtPhone.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// lblFirstName
|
||||||
|
//
|
||||||
|
this.lblFirstName.AutoSize = true;
|
||||||
|
this.lblFirstName.Location = new System.Drawing.Point(9, 44);
|
||||||
|
this.lblFirstName.Name = "lblFirstName";
|
||||||
|
this.lblFirstName.Size = new System.Drawing.Size(49, 13);
|
||||||
|
this.lblFirstName.TabIndex = 18;
|
||||||
|
this.lblFirstName.Text = "Fornavn:";
|
||||||
|
//
|
||||||
|
// lblLastName
|
||||||
|
//
|
||||||
|
this.lblLastName.AutoSize = true;
|
||||||
|
this.lblLastName.Location = new System.Drawing.Point(9, 70);
|
||||||
|
this.lblLastName.Name = "lblLastName";
|
||||||
|
this.lblLastName.Size = new System.Drawing.Size(56, 13);
|
||||||
|
this.lblLastName.TabIndex = 19;
|
||||||
|
this.lblLastName.Text = "Etternavn:";
|
||||||
|
//
|
||||||
|
// lblAddress
|
||||||
|
//
|
||||||
|
this.lblAddress.AutoSize = true;
|
||||||
|
this.lblAddress.Location = new System.Drawing.Point(9, 96);
|
||||||
|
this.lblAddress.Name = "lblAddress";
|
||||||
|
this.lblAddress.Size = new System.Drawing.Size(48, 13);
|
||||||
|
this.lblAddress.TabIndex = 20;
|
||||||
|
this.lblAddress.Text = "Adresse:";
|
||||||
|
//
|
||||||
|
// lblPoststed
|
||||||
|
//
|
||||||
|
this.lblPoststed.AutoSize = true;
|
||||||
|
this.lblPoststed.Location = new System.Drawing.Point(9, 121);
|
||||||
|
this.lblPoststed.Name = "lblPoststed";
|
||||||
|
this.lblPoststed.Size = new System.Drawing.Size(51, 13);
|
||||||
|
this.lblPoststed.TabIndex = 22;
|
||||||
|
this.lblPoststed.Text = "Poststed:";
|
||||||
|
//
|
||||||
|
// lblPhone
|
||||||
|
//
|
||||||
|
this.lblPhone.AutoSize = true;
|
||||||
|
this.lblPhone.Location = new System.Drawing.Point(9, 148);
|
||||||
|
this.lblPhone.Name = "lblPhone";
|
||||||
|
this.lblPhone.Size = new System.Drawing.Size(46, 13);
|
||||||
|
this.lblPhone.TabIndex = 23;
|
||||||
|
this.lblPhone.Text = "Telefon:";
|
||||||
|
//
|
||||||
|
// lblAge
|
||||||
|
//
|
||||||
|
this.lblAge.AutoSize = true;
|
||||||
|
this.lblAge.Location = new System.Drawing.Point(9, 178);
|
||||||
|
this.lblAge.Name = "lblAge";
|
||||||
|
this.lblAge.Size = new System.Drawing.Size(34, 13);
|
||||||
|
this.lblAge.TabIndex = 24;
|
||||||
|
this.lblAge.Text = "Alder:";
|
||||||
|
//
|
||||||
|
// btnOpenPoststed
|
||||||
|
//
|
||||||
|
this.btnOpenPoststed.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
|
this.btnOpenPoststed.Location = new System.Drawing.Point(12, 12);
|
||||||
|
this.btnOpenPoststed.Name = "btnOpenPoststed";
|
||||||
|
this.btnOpenPoststed.Size = new System.Drawing.Size(405, 23);
|
||||||
|
this.btnOpenPoststed.TabIndex = 1;
|
||||||
|
this.btnOpenPoststed.Text = "Behandle poststed";
|
||||||
|
this.btnOpenPoststed.UseVisualStyleBackColor = true;
|
||||||
|
this.btnOpenPoststed.Click += new System.EventHandler(this.btnOpenPoststed_Click);
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(9, 200);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(67, 13);
|
||||||
|
this.label1.TabIndex = 25;
|
||||||
|
this.label1.Text = "Kjønn (M/K):";
|
||||||
|
//
|
||||||
|
// listBox1
|
||||||
|
//
|
||||||
|
this.listBox1.FormattingEnabled = true;
|
||||||
|
this.listBox1.Items.AddRange(new object[] {
|
||||||
|
"M",
|
||||||
|
"K"});
|
||||||
|
this.listBox1.Location = new System.Drawing.Point(104, 197);
|
||||||
|
this.listBox1.Name = "listBox1";
|
||||||
|
this.listBox1.Size = new System.Drawing.Size(313, 30);
|
||||||
|
this.listBox1.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// numAge
|
||||||
|
//
|
||||||
|
this.numAge.Location = new System.Drawing.Point(104, 172);
|
||||||
|
this.numAge.Maximum = new decimal(new int[] {
|
||||||
|
120,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numAge.Minimum = new decimal(new int[] {
|
||||||
|
6,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numAge.Name = "numAge";
|
||||||
|
this.numAge.Size = new System.Drawing.Size(313, 20);
|
||||||
|
this.numAge.TabIndex = 7;
|
||||||
|
this.numAge.Value = new decimal(new int[] {
|
||||||
|
6,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// listPoststed
|
||||||
|
//
|
||||||
|
this.listPoststed.FormattingEnabled = true;
|
||||||
|
this.listPoststed.Location = new System.Drawing.Point(104, 118);
|
||||||
|
this.listPoststed.Name = "listPoststed";
|
||||||
|
this.listPoststed.Size = new System.Drawing.Size(316, 21);
|
||||||
|
this.listPoststed.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// StudentForm
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(1330, 565);
|
||||||
|
this.Controls.Add(this.listPoststed);
|
||||||
|
this.Controls.Add(this.numAge);
|
||||||
|
this.Controls.Add(this.listBox1);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.btnOpenPoststed);
|
||||||
|
this.Controls.Add(this.lblAge);
|
||||||
|
this.Controls.Add(this.lblPhone);
|
||||||
|
this.Controls.Add(this.lblPoststed);
|
||||||
|
this.Controls.Add(this.lblAddress);
|
||||||
|
this.Controls.Add(this.lblLastName);
|
||||||
|
this.Controls.Add(this.lblFirstName);
|
||||||
|
this.Controls.Add(this.txtPhone);
|
||||||
|
this.Controls.Add(this.txtAddress);
|
||||||
|
this.Controls.Add(this.txtLastName);
|
||||||
|
this.Controls.Add(this.txtFirstName);
|
||||||
|
this.Controls.Add(this.btnCancelStudent);
|
||||||
|
this.Controls.Add(this.btnDeleteStudent);
|
||||||
|
this.Controls.Add(this.btnSaveStudent);
|
||||||
|
this.Controls.Add(this.btnSearchStudent);
|
||||||
|
this.Controls.Add(this.lblSearchStudent);
|
||||||
|
this.Controls.Add(this.txtStudentSearch);
|
||||||
|
this.Controls.Add(this.gridStudentList);
|
||||||
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||||
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.Name = "StudentForm";
|
||||||
|
this.Text = "MySQL Stored Procedure Student";
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridStudentList)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numAge)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private System.Windows.Forms.DataGridView gridStudentList;
|
||||||
|
private System.Windows.Forms.TextBox txtStudentSearch;
|
||||||
|
private System.Windows.Forms.Label lblSearchStudent;
|
||||||
|
private System.Windows.Forms.Button btnSearchStudent;
|
||||||
|
private System.Windows.Forms.Button btnSaveStudent;
|
||||||
|
private System.Windows.Forms.Button btnDeleteStudent;
|
||||||
|
private System.Windows.Forms.Button btnCancelStudent;
|
||||||
|
private System.Windows.Forms.TextBox txtFirstName;
|
||||||
|
private System.Windows.Forms.TextBox txtLastName;
|
||||||
|
private System.Windows.Forms.TextBox txtAddress;
|
||||||
|
private System.Windows.Forms.TextBox txtPhone;
|
||||||
|
private System.Windows.Forms.Label lblFirstName;
|
||||||
|
private System.Windows.Forms.Label lblLastName;
|
||||||
|
private System.Windows.Forms.Label lblAddress;
|
||||||
|
private System.Windows.Forms.Label lblPoststed;
|
||||||
|
private System.Windows.Forms.Label lblPhone;
|
||||||
|
private System.Windows.Forms.Label lblAge;
|
||||||
|
private System.Windows.Forms.Button btnOpenPoststed;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.ListBox listBox1;
|
||||||
|
private System.Windows.Forms.NumericUpDown numAge;
|
||||||
|
private System.Windows.Forms.ComboBox listPoststed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
|
namespace MySQLStoredProcedureStudent
|
||||||
|
{
|
||||||
|
public partial class StudentForm : Form
|
||||||
|
{
|
||||||
|
private Poststed poststedForm = null;
|
||||||
|
private string _connectionString = "Server=localhost;Port=33060;User=root;Password=root123;Database=student2018;";
|
||||||
|
private MySqlConnection _connection = null;
|
||||||
|
|
||||||
|
private int _studentId = 0;
|
||||||
|
|
||||||
|
public StudentForm()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
_connection = new MySqlConnection(_connectionString);
|
||||||
|
_connection.Open();
|
||||||
|
|
||||||
|
GridFill();
|
||||||
|
ClearFields();
|
||||||
|
UpdatePoststedList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdatePoststedList()
|
||||||
|
{
|
||||||
|
listPoststed.Items.Clear();
|
||||||
|
|
||||||
|
var command = new MySqlDataAdapter("PoststedViewAll", _connection);
|
||||||
|
command.SelectCommand.CommandType = CommandType.StoredProcedure;
|
||||||
|
|
||||||
|
var dataTable = new DataTable();
|
||||||
|
command.Fill(dataTable);
|
||||||
|
|
||||||
|
foreach (DataRow row in dataTable.Rows)
|
||||||
|
{
|
||||||
|
var items = row.ItemArray;
|
||||||
|
|
||||||
|
var postnummer = items[0].ToString();
|
||||||
|
// In the database I have "ZEROFILL", but when retrieving
|
||||||
|
// this value it will not be zerofilled. This is a dirty hack
|
||||||
|
// so that the visual representation is as it should be in the list.
|
||||||
|
postnummer = postnummer.PadLeft(4, '0');
|
||||||
|
|
||||||
|
var poststed = items[1].ToString();
|
||||||
|
|
||||||
|
var poststedItem = new PoststedItem(postnummer, poststed);
|
||||||
|
listPoststed.Items.Add(poststedItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GridFill()
|
||||||
|
{
|
||||||
|
var command = new MySqlDataAdapter("StudentViewAll", _connection);
|
||||||
|
command.SelectCommand.CommandType = CommandType.StoredProcedure;
|
||||||
|
|
||||||
|
var dataTable = new DataTable();
|
||||||
|
command.Fill(dataTable);
|
||||||
|
|
||||||
|
gridStudentList.DataSource = dataTable;
|
||||||
|
// Hide "idStudent" column
|
||||||
|
gridStudentList.Columns[0].Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearFields()
|
||||||
|
{
|
||||||
|
txtFirstName.Clear();
|
||||||
|
txtLastName.Clear();
|
||||||
|
txtAddress.Clear();
|
||||||
|
txtPhone.Clear();
|
||||||
|
numAge.Value = 20;
|
||||||
|
|
||||||
|
_studentId = 0;
|
||||||
|
|
||||||
|
btnSaveStudent.Text = "Lagre";
|
||||||
|
btnDeleteStudent.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOpenPoststed_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (poststedForm == null || poststedForm.IsDisposed)
|
||||||
|
{
|
||||||
|
poststedForm = new Poststed(_connection, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
poststedForm.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user