python contact search
parent
efb5af848f
commit
80376ea6d2
@ -1,3 +1,3 @@
|
||||
@page "/"
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
<h1>Willkommen zu Gremlin Blazor!</h1>
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
{
|
||||
"AllowedHosts": "*",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
{
|
||||
"objectscript.conn": {
|
||||
"active": true
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
import mysql.connector as database
|
||||
|
||||
connection = database.connect(
|
||||
host="woitschetzki.de",
|
||||
port="3306",
|
||||
user="sascha",
|
||||
password="mgltoJtmmDnKJ86LltsGdw",
|
||||
database="regulus")
|
||||
|
||||
cursor = connection.cursor()
|
||||
|
||||
|
||||
def getContact(lastName):
|
||||
try:
|
||||
statement = "SELECT ContactId, AccountId, FirstName, LastName, Gender, Email FROM Contacts WHERE LastName LIKE %s"
|
||||
data = (lastName,)
|
||||
cursor.execute(statement, data)
|
||||
rows = list(cursor)
|
||||
|
||||
print(f"Found {len(rows)} contacts with {lastName} in LastName:")
|
||||
print("ContactId | AccountID | FirstName | LastName | Gender | Email")
|
||||
|
||||
for (contactId, AccountId, firstName, lastName, gender, email) in rows:
|
||||
print(
|
||||
f"{contactId} | {AccountId} | {firstName} | {lastName} | {gender} | {email}")
|
||||
|
||||
except database.Error as error:
|
||||
print(f"Error retrieving entry from database: {error}")
|
||||
|
||||
|
||||
print("Willkommen bei Gremlin_Python!")
|
||||
|
||||
while 2 > 1:
|
||||
print("Nach welchem Kunden suchen Sie?: ")
|
||||
contactSearch = input()
|
||||
getContact(f"%{contactSearch}%")
|
||||
|
||||
connection.close()
|
||||
@ -0,0 +1,35 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>9e0cf057-c3d7-4f60-a4ec-93e712610b53</ProjectGuid>
|
||||
<ProjectHome>.</ProjectHome>
|
||||
<StartupFile>Gremlin_Python.py</StartupFile>
|
||||
<SearchPath>
|
||||
</SearchPath>
|
||||
<WorkingDirectory>.</WorkingDirectory>
|
||||
<OutputPath>.</OutputPath>
|
||||
<Name>Gremlin_Python</Name>
|
||||
<RootNamespace>Gremlin_Python</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Gremlin_Python.py" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
|
||||
<!-- Uncomment the CoreCompile target to enable the Build command in
|
||||
Visual Studio and specify your pre- and post-build commands in
|
||||
the BeforeBuild and AfterBuild targets below. -->
|
||||
<!--<Target Name="CoreCompile" />-->
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
</Project>
|
||||
Loading…
Reference in New Issue