Click here to Skip to main content
16,020,459 members

Comments by hspl (Top 38 by date)

hspl 8-Sep-15 3:02am View    
Can you please help me with your codes.....i want to add more columns in existing table
i try with below code but it not works.....

Private Sub AddCol_ToDept_Tbl()
Dim conStr As String = "Server=.;Database=PMS;Integrated Security = True;MultipleActiveResultSets=True;"
Dim objCon As New SqlConnection(cnSettings2)
Dim obj As SqlCommand
Dim strSQL As String
Dim myReader As SqlDataReader
objCon.Open()
obj = objCon.CreateCommand()
Try
strSQL = "SELECT * FROM sys.columns WHERE object_id= OBJECT_ID(N'[dbo].[Dept]') AND name='Flag2'"
'strSQL = "SELECT * FROM sys.tables WHERE name='Dept'"
' strSQL = "SELECT * FROM master.dbo.systables WHERE name='Dept'"
obj.CommandText = strSQL
myReader = obj.ExecuteReader()
If Not myReader.Read() Then
myReader.Close()
strSQL = "ALTER TABLE Dept ADD Flag2 varchar(2) not null"
' Execute
obj.CommandText = strSQL
obj.ExecuteNonQuery()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
objCon.Close()
objCon = Nothing
End Sub
hspl 24-Aug-15 4:23am View    
Yes
hspl 23-Aug-15 23:41pm View    
When form opens by default all Present column value shows YES
I want to do like this, if user want to change any cell value of present column
from YES to NO or NO to YES by selecting that cell and pressing enter or space bar key.
hspl 23-Aug-15 23:32pm View    
can you help me with codes.
hspl 23-Aug-15 23:30pm View    
sir
if second gets a path name(eg:D:\Pms) not No