Disable Editing in Combo Box

0

Hi Guys..

If you want to disable editing in Combo Box Control and if you just want user to select one of options then You just need to set,

Combobox_1.DropDownStyle = DropDownList

You can do this in designer also.

Mass Rename Files in Folder

0

Hi,

This Small Code Helps us to Rename file in the Folder… Be Carefull with it..

 If Directory.Exists(TextBox1.Text) Then
            If Not TextBox2.Text = "" Then

                Dim str As String
                Dim ct As Integer
                ct = 0
                Try

                    For Each element As String In Directory.GetFiles(TextBox1.Text)
                        ListBox1.Items.Add(element)
                        str = TextBox1.Text & "\" & TextBox2.Text & " " & ct & ".jpg"
                        File.Move(element, str)
                        ct += 1
                    Next
                Catch ex As Exception
                    MsgBox(ex.ToString)
                End Try

                For Each element As String In Directory.GetFiles(TextBox1.Text)
                    ListBox2.Items.Add(element)
                Next
            Else
                MsgBox("Value Missing")

            End If
        Else
            MsgBox("Directory Not Found")
        End If

Textbox1 gets the folder name and More >

SQL Endpoints

0

This is one of exciting feature in Microsoft SQL Server. This feature has been introduced only after SQL Server 2005. It is used to Expose our Database over HTTP so that each and every time we dont need to connect directly to database. We just need to send query to web service and then it takes care of all other stuffs…

Syntax for creating SQL Endpoint is

CREATE ENDPOINT sql_endpoint 
STATE = STARTED
AS HTTP(
   PATH = '/findurcodes', 
   AUTHENTICATION = (INTEGRATED ), 
   PORTS = ( CLEAR ), 
   SITE = 'SERVER'
   )
FOR SOAP (
   WEBMETHOD 'GetMethodName' 
            (name='dbo.xp_msver', 
             SCHEMA=STANDARD

More >

SQL Query: Primary Key Constraint

0

The Primary key of a relational table should uniquely identify each record in the table. These Keys contains only Unique Values and cannot be Null. It Ensures only Unique Values by which we can easily get a record in table.

Each Table can have only one primary key but can have many unique keys. (Candidate Columns) Syntax for Creating Primary key is,

 CREATE TABLE EMP
 (
 E_Id int NOT NULL PRIMARY KEY,
 L_Name varchar(255) NOT NULL,
 F_Name varchar(255),
 )

To Insert Primary key in a table,

ALTER TABLE EMP
ADD CONSTRAINT pk_ID PRIMARY KEY (E_Id,L_Name)

To Drop a Primary More >

SQL TOP Clause

0

hi friends,

 

SQL’s TOP Keyword is specified in query to return only selected number of rows. When the Result set has more records, like if it has more than 1000 records, the query execution time will be more… In that time if we need only first few records instead of whole result set, then we can use this keyword to optimize our Query.

Syntax is

SELECT TOP [number|percent] column_name FROM table_name

example,

SELECT TOP 2 FROM EMP

 

This will give only first 2 records from Emp Table.

DataRelation Between DataTable in Dataset

1

hi frnds,

In this post i will show you a simple way to establish datarelation between datatables in a dataset and then binding it in datagrid…

Well lets start with two tables, Tab Name Col1 Col2 Col3 Tab1 ID Name Tab2 ID Dept SAL

In Visual studio, We start by adding a datagrid in windows form..

Then,        
        Dim cons As New String("Data Source=xxxx\SQLEXPRESS;Initial Catalog=emp;Integrated Security=True")  'Create Connection string...
        Dim sql1 As New String("Select * from tab1")
        Dim sql2 As New String("Select * from tab2")
        Dim sql As New String(sql1 & " ; " & sql2)   'Two queries or else we

More >

Change “devenv” Command Shortcut from VS 2008 to VS 2010

0

Hi guys!!

Well first problem that i had after upgrading is that i lost my shortcut of “devenv” which should open vs 2010 but it opened vs 2008…. as the executables of both versions are same, we either need to change the Command Text of Devenv or we have to do a small edit in registry path…

GOTO:

First type “regedit” in rum command and press enter.. then navigate to below path.

\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\devenv.exe

Now double click the value on right side and change from

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe

to

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

Thats it More >

Bind Data to Combo Box

1

hi,

Here i will show a simplest way to bind data to a combo box retrieved from database. To put it simple, First we need to get Tables from Database, then we can bind particular columns value to combo box.

Here is how we bind data to combo box in .net

connetionString = "Data Source=<server_name>;Initial Catalog=<DB_name>;Integrated Security=True"
 cnn = New SqlConnection(connetionString)
 ad = New SqlDataAdapter("Select * from Table", cnn)
 ad.Fill(ds, "col_name")
 ComboBox1.DataSource = ds.Tables(0)
 ComboBox1.DisplayMember = "Table1.Col_name"
 ComboBox1.ValueMember = "Col_name"
 

Creating a connection Between SQL Server and Vb .Net

0

hi friends,

 

Here i will show a very simple way to create a connection between SQL Server and Vb.Net. This is one of very simplest way to create a connection between sql server and visual studio vb.net.

Dim conString As String
 Dim cnn As SqlConnection
 conString = "Data Source=Yogesh_Lap;Initial Catalog=Account;Integrated Security=True" 'Literally, i am giving my server name, database name, and telling to use windows login info. 
 cnn = New SqlConnection(conString)
 Try
 cnn.Open()
 MsgBox("Connection Opened Successfully! ")
 cnn.Close()
 Catch ex As Exception
 MsgBox("Connection Open Failed! ")
 End Try
Go to Top