Click here to Skip to main content
15,891,033 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Convert VB to C# Pin
Eddy Vluggen1-Dec-16 8:24
professionalEddy Vluggen1-Dec-16 8:24 
GeneralRe: Convert VB to C# Pin
Pavlex46-Dec-16 22:30
Pavlex46-Dec-16 22:30 
GeneralRe: Convert VB to C# Pin
Eddy Vluggen7-Dec-16 0:29
professionalEddy Vluggen7-Dec-16 0:29 
GeneralRe: Convert VB to C# Pin
Pavlex47-Dec-16 0:49
Pavlex47-Dec-16 0:49 
GeneralRe: Convert VB to C# Pin
Eddy Vluggen7-Dec-16 1:04
professionalEddy Vluggen7-Dec-16 1:04 
GeneralRe: Convert VB to C# Pin
Pavlex47-Dec-16 1:07
Pavlex47-Dec-16 1:07 
GeneralRe: Convert VB to C# Pin
Eddy Vluggen7-Dec-16 1:12
professionalEddy Vluggen7-Dec-16 1:12 
GeneralRe: Convert VB to C# Pin
Pavlex47-Dec-16 1:14
Pavlex47-Dec-16 1:14 
Like this?

C#
string cs = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename= C:\Users\Pavle\Documents\Visual Studio 2015\Projects\Test slagalica\Test slagalica\Slagalica-DB.mdf;Integrated Security=True";
            string queryString = "SELECT * FROM table1 WHERE LEN(Reci) >=10 AND LEN(Reci) <=12 ORDER BY RAND()";
            string query = "SELECT * FROM table1 ORDER BY RAND()";
            using (SqlConnection connection = new SqlConnection(cs))
            {
                SqlCommand mycommand = new SqlCommand(queryString, connection);
                SqlCommand mycommand2 = new SqlCommand(query, connection);
                try
                {
                    connection.Open();
                    string word = (string)mycommand.ExecuteScalar();
                    word = (string)mycommand2.ExecuteScalar();
                    label14.Text = word;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

GeneralRe: Convert VB to C# Pin
Eddy Vluggen7-Dec-16 2:49
professionalEddy Vluggen7-Dec-16 2:49 
GeneralRe: Convert VB to C# Pin
Pavlex47-Dec-16 8:51
Pavlex47-Dec-16 8:51 
GeneralRe: Convert VB to C# Pin
Eddy Vluggen7-Dec-16 9:31
professionalEddy Vluggen7-Dec-16 9:31 
GeneralRe: Convert VB to C# Pin
Pavlex47-Dec-16 10:29
Pavlex47-Dec-16 10:29 
GeneralRe: Convert VB to C# Pin
Pavlex47-Dec-16 11:43
Pavlex47-Dec-16 11:43 
GeneralRe: Convert VB to C# Pin
Pavlex47-Dec-16 21:31
Pavlex47-Dec-16 21:31 
GeneralRe: Convert VB to C# Pin
Eddy Vluggen8-Dec-16 3:02
professionalEddy Vluggen8-Dec-16 3:02 
GeneralRe: Convert VB to C# Pin
Pavlex48-Dec-16 7:55
Pavlex48-Dec-16 7:55 
GeneralRe: Convert VB to C# Pin
Pavlex48-Dec-16 12:27
Pavlex48-Dec-16 12:27 
GeneralRe: Convert VB to C# Pin
Eddy Vluggen9-Dec-16 2:59
professionalEddy Vluggen9-Dec-16 2:59 
GeneralRe: Convert VB to C# Pin
Pavlex49-Dec-16 7:28
Pavlex49-Dec-16 7:28 
GeneralRe: Convert VB to C# Pin
Eddy Vluggen9-Dec-16 7:58
professionalEddy Vluggen9-Dec-16 7:58 
QuestionEquals/Comparison of the two objects in which the property of the list(as object) Pin
Cvele12329-Nov-16 4:29
Cvele12329-Nov-16 4:29 
QuestionRe: Equals/Comparison of the two objects in which the property of the list(as object) Pin
ZurdoDev29-Nov-16 6:20
professionalZurdoDev29-Nov-16 6:20 
AnswerRe: Equals/Comparison of the two objects in which the property of the list(as object) Pin
Cvele12329-Nov-16 6:28
Cvele12329-Nov-16 6:28 
AnswerRe: Equals/Comparison of the two objects in which the property of the list(as object) Pin
Cvele1239-Dec-16 2:05
Cvele1239-Dec-16 2:05 
QuestionWhy the picture not save correctly if I change from button click to form load Pin
Munirah Malik28-Nov-16 15:46
Munirah Malik28-Nov-16 15:46 

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.