Click here to Skip to main content
15,608,738 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# SQL Server problem Pin
OriginalGriff10-Dec-16 5:59
mvaOriginalGriff10-Dec-16 5:59 
GeneralRe: C# SQL Server problem Pin
Pavlex410-Dec-16 6:04
Pavlex410-Dec-16 6:04 
GeneralRe: C# SQL Server problem Pin
OriginalGriff10-Dec-16 6:23
mvaOriginalGriff10-Dec-16 6:23 
GeneralRe: C# SQL Server problem Pin
Pavlex410-Dec-16 6:49
Pavlex410-Dec-16 6:49 
GeneralRe: C# SQL Server problem Pin
OriginalGriff10-Dec-16 7:28
mvaOriginalGriff10-Dec-16 7:28 
QuestionC# Check if textbox value exists in SQL server database Pin
Pavlex410-Dec-16 2:31
Pavlex410-Dec-16 2:31 
AnswerRe: C# Check if textbox value exists in SQL server database Pin
Wendelius10-Dec-16 2:40
mveWendelius10-Dec-16 2:40 
GeneralRe: C# Check if textbox value exists in SQL server database Pin
Pavlex410-Dec-16 4:16
Pavlex410-Dec-16 4:16 
Can it be done like this:

C#
using (SqlConnection connection = new SqlConnection(cs))
                {
                    SqlCommand cmd = new SqlCommand("SELECT * FROM table1 WHERE Reci='" + textBox1.Text + "'", connection);
                    try
                    {
                        connection.Open();
                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        DataSet ds = new DataSet();
                        da.Fill(ds);
                        int j = ds.Tables[0].Rows.Count;
                        if (j == 0)
                        {
                            MessageBox.Show("word" + textBox1.Text + "already exists!");
                            ds.Clear();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }

GeneralRe: C# Check if textbox value exists in SQL server database Pin
PIEBALDconsult10-Dec-16 4:22
professionalPIEBALDconsult10-Dec-16 4:22 
AnswerRe: C# Check if textbox value exists in SQL server database Pin
Wendelius10-Dec-16 5:18
mveWendelius10-Dec-16 5:18 
QuestionC# Textbox Pin
Pavlex49-Dec-16 6:57
Pavlex49-Dec-16 6:57 
AnswerRe: C# Textbox Pin
Michael_Davies9-Dec-16 7:03
Michael_Davies9-Dec-16 7:03 
GeneralRe: C# Textbox Pin
Pavlex49-Dec-16 7:06
Pavlex49-Dec-16 7:06 
GeneralRe: C# Textbox Pin
Michael_Davies9-Dec-16 7:29
Michael_Davies9-Dec-16 7:29 
GeneralRe: C# Textbox Pin
Pavlex49-Dec-16 7:41
Pavlex49-Dec-16 7:41 
GeneralRe: C# Textbox Pin
Eddy Vluggen9-Dec-16 8:01
professionalEddy Vluggen9-Dec-16 8:01 
GeneralRe: C# Textbox Pin
Michael_Davies9-Dec-16 8:23
Michael_Davies9-Dec-16 8:23 
AnswerRe: C# Textbox Pin
Gerry Schmitz9-Dec-16 8:26
mveGerry Schmitz9-Dec-16 8:26 
AnswerRe: C# Textbox Pin
OriginalGriff9-Dec-16 8:27
mvaOriginalGriff9-Dec-16 8:27 
GeneralRe: C# Textbox Pin
Pavlex49-Dec-16 22:06
Pavlex49-Dec-16 22:06 
GeneralRe: C# Textbox Pin
OriginalGriff9-Dec-16 22:21
mvaOriginalGriff9-Dec-16 22:21 
GeneralRe: C# Textbox Pin
Pavlex49-Dec-16 23:07
Pavlex49-Dec-16 23:07 
GeneralRe: C# Textbox Pin
OriginalGriff9-Dec-16 23:38
mvaOriginalGriff9-Dec-16 23:38 
GeneralRe: C# Textbox Pin
Pavlex410-Dec-16 0:09
Pavlex410-Dec-16 0:09 
GeneralRe: C# Textbox Pin
OriginalGriff10-Dec-16 0:24
mvaOriginalGriff10-Dec-16 0:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.