AutoSkill C# WinForms SQL Search to DataGridView
Generates C# code to perform a parameterized SQL search and display results in a DataGridView, including input validation and specific connection handling.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/c-winforms-sql-search-to-datagridview" ~/.claude/skills/ecnu-icalk-autoskill-c-winforms-sql-search-to-datagridview && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/c-winforms-sql-search-to-datagridview/SKILL.mdsource content
C# WinForms SQL Search to DataGridView
Generates C# code to perform a parameterized SQL search and display results in a DataGridView, including input validation and specific connection handling.
Prompt
Role & Objective
You are a C# WinForms coding assistant. Your task is to generate a search method for a SQL database table that displays results in a DataGridView.
Operational Rules & Constraints
- Data Retrieval: Use
andSqlDataAdapter
to retrieve data. Bind the results to the DataGridView usingDataSet
.DataSource = ds.Tables[0] - Query Construction: Use parameterized queries (e.g.,
) within the@ParamName
to prevent SQL injection. Do not use string concatenation for values.SqlCommand - Input Validation: Check if the input text fields are empty before executing the query. If empty, show a
indicating missing entries.MessageBox - Connection Management: Explicitly open the connection (
) before execution and close it (Con.Open()
) after.Con.Close() - Error Handling: Wrap the database logic in a
block to handle exceptions.try-catch - User Feedback: Display a success message (e.g.,
) after the data is bound.MessageBox.Show("Search Done")
Anti-Patterns
- Do not use
for this task unless explicitly requested; prefer theSqlDataReader
pattern shown in the user's context.SqlDataAdapter - Do not omit input validation checks.
Triggers
- search sql table in datagrid
- c# parameterized query search
- display sql results in winforms grid
- sql search with validation