16,020,459 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Visual Basic questions
View Javascript questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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
hspl
23-Aug-15 3:58am
View
Sir,
I made a declaration that
Dim bkp_path as String in form
And by default bkp_path = No which i read from database
hspl
20-Aug-15 4:17am
View
Please any body help me
hspl
17-Aug-15 3:35am
View
can you please help me
hspl
17-Aug-15 3:21am
View
Staffs table does not contain dept number.
hspl
2-Aug-15 11:35am
View
Here is my relevant code and errors are in brackets:-
Private Sub GirdFormat()
Dim num As Integer
Me.Dt.Clear()
Me.Dt1.Clear()
Me.Dt2.Clear()
Mod_DataBase.CmdStr = "Select UserName from Mas_User"
Me.Dsfrm.Tables.Clear()
Me.Dsfrm = Mod_Connection.Returnglobaldata(Mod_DataBase.CmdStr)
Me.Dt.Clear()
Me.Dt = Me.Dsfrm.Tables.Item(0)
Mod_DataBase.CmdStr = "select distinct operation from SecuritySetup order by Operation"
Me.Dsfrm.Tables.Clear()
Me.Dsfrm = Mod_Connection.ReturnYeardata(Mod_DataBase.CmdStr)
Me.Dt2.Clear()
Me.Dt2 = Me.Dsfrm.Tables.Item(0)
'num()
For num = 0 To Me.Dt.Rows.Count - 1
dgv.Columns.Add() <<--(Error = Overload resolution failed because no accesible 'Add' accepts this no. of arguments)
Next (num)
dgv.Columns.Count = (Dt.Rows.Count + 2) <<--(Error = PropertyGrid 'Count' is ReadOnly)
Me.dgv.EditMode = False
'Me.dgv.autos = AutoSearchEnum.FromCursor
Me.dgv.Rows.Count = (Me.Dt2.Rows.Count + 1) <<--(Error = PropertyGrid 'Count' is ReadOnly)
Dim vsfgSecuritySetup As DataGridView = dgv
vsfgSecuritySetup.Clear(ClearFlags.All) <<--(Error = 'ClearFlag's is not declared.)
vsfgSecuritySetup.Columns.Frozen = 1 <<--(Err = Frozen not a member of datagridview column collection)
vsfgSecuritySetup.Columns.Fixed = 1 <<--(Err = Fixed not a member of datagridview column collection)
' vsfgSecuritySetup.Columns.Item(0).Caption = "SRNO"
vsfgSecuritySetup.Columns.Item(0).Name = "SRNO"
vsfgSecuritySetup.Columns.Item(0).Width = 40
vsfgSecuritySetup.Columns.Item(1).Name = "OPERATION"
vsfgSecuritySetup.Columns.Item(1).Width = 250
Me.m = 1
Do While (Me.m < Me.dgv.Rows.Count)
Me.dgv.Item(Me.m, 1) = Me.Dt2.Rows.Item((Me.m - 1)).Item(0).ToString <<(Erroris Value of type String cannot converted dgv cell)
Me.m += 1
Loop
num = 2
Dim i As Integer = 0
Do While (num < Me.dgv.Columns.Count)
vsfgSecuritySetup.Columns.Item(num).Name = Me.Dt.Rows.Item(i).Item(0).ToString
vsfgSecuritySetup.Columns.Item(num).Width = 100
vsfgSecuritySetup.Columns.Item(num).DataType = GetType(Boolean) <<--(Erroris = Data Type is not a member of dgv column)
num += 1
i += 1
Loop
'num()
For num = 1 To Me.dgv.Rows.Count - 1
Me.dgv.Item(num, Me.dgv.Columns.IndexOf("SRNO")) = num <<(Erroris Value of type String cannot converted dgv cell)
Next num
vsfgSecuritySetup = Nothing
Me.j = 1
Me.m = 2
Do While (Me.m < Me.dgv.Columns.Count)
Me.j = 1
Do While (Me.j < Me.dgv.Rows.Count)
Mod_DataBase.CmdStr = String.Concat(New String() {"select allow from SecuritySetup where UserName='", Me.dgv.Item(0, Me.m).ToString, "' and operation='", Me.dgv.Item(Me.j, 1).ToString, "' order by Operation"})
Me.Dsfrm.Tables.Clear()
Me.Dsfrm = Mod_Connection.ReturnYeardata(Mod_DataBase.CmdStr)
Me.Dt1.Clear()
Me.Dt1 = Me.Dsfrm.Tables.Item(0)
If (Me.Dt1.Rows.Count > 0) Then
If (Me.Dt1.Rows.Item(0).Item(0).ToString = "Y") Then
Me.dgv.Item(Me.j, Me.m) = True <<(TypeBoolean cannot be converted to dgv cell)
Else
Me.dgv.Item(Me.j, Me.m) = False <<(TypeBoolean cannot be converted to dgv cell)
End If
Else
Me.dgv.Item(Me.j, Me.m) = False <<(TypeBoolean cannot be converted to dgv cell)
End If
Me.j += 1
Loop
Me.m += 1
Loop
Dim range As cellrange = Me.dgv.GetCe
hspl
2-Aug-15 7:23am
View
Deleted
OK
hspl
2-Aug-15 7:21am
View
I do the process you mentioned by selecting remote connections>>enabled local and
remote connections checked radio button>>then checked using TCP/IP only.
but still not works......
hspl
27-Mar-13 10:25am
View
Sir, "Dgv_CellClick" option is not showing in Click event dropdownlist of Button event tab option.
hspl
9-Mar-13 6:52am
View
I didn't understand that artcle....please send me codes with examples...
hspl
5-Feb-13 1:44am
View
Sir,
But i want to say that you did not give me full solution, it always shows an error.
Which i told you thru my comments....
hspl
5-Feb-13 1:19am
View
Sir,
I myself solved the solution, and submit it also.Please see....
hspl
5-Feb-13 1:16am
View
Dear Sir,
I am sorry to say that as per database naming rules we cannot give the numeric as database name which you have told in your last comment.
Well i feel happy that i solved the problem with my own tricks and able to create
NUMERIC as database name, below is the my solution......
Private Sub btnCreateDataBase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateDataBase.Click
DIM dbname AS STRING
dbname = TEXTBOX1.TEXT
Dim conStr As String = "Server=Myserver;Database=;Trusted_Connection = yes"
Dim objCon As New SqlConnection(conStr)
Dim obj As SqlCommand
Dim strSQL As String
' Create the database
objCon.Open()
obj = objCon.CreateCommand()
strSQL = "CREATE DATABASE [" + dbname + "]"
' Execute
obj.CommandText = strSQL
Try
obj.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
objCon.Close()
objCon = Nothing
End Sub
After running this it will successfully create the database having name in numeric.
Indranil
hspl
4-Feb-13 10:03am
View
Sir
I want to create database with the numeric value of a textbox
So how can i do that.....
hspl
4-Feb-13 7:02am
View
Sir
Again same message shows that...
There is already an open DataReader associated with this Command which must be closed first
hspl
4-Feb-13 6:58am
View
Sir waiting for your reply against my comment....
hspl
4-Feb-13 1:45am
View
Sir,
I used value of TextBox1.text = 1001
But when i click on CreateDatabase button an error shows that
Incorrect Syntax Near '1001'.
hspl
4-Feb-13 1:32am
View
Same error shows that Close is not a member of System.Data.SqlClient.SqlCommand
hspl
1-Feb-13 9:15am
View
Its throwing an error here:-
obj.Close() <--"Close is not a member of System.Data.SqlClient.SqlCommand"
hspl
1-Feb-13 7:07am
View
Sir
Here " SET " word said that its nolonger supported
And obj.Close() here said Close is not a member of 'System.Data.SqlClient.SqlCommand'
hspl
1-Feb-13 5:25am
View
Sir waiting for your suggestion on my last comment....
hspl
1-Feb-13 1:59am
View
A message shows that "There is already an open DataReader associated with this Command which must be closed first"
hspl
1-Feb-13 1:34am
View
Sorry to say that after putting the codes in Form_Load event and run it, it will not
create any database in sql server.
hspl
31-Jan-13 9:53am
View
Thanks for your answer but i could not find where i put these queiries in below form1_load event :-
'CREATING DATABASE.........................
Dim conStr As String = "Server=.;Database=;Trusted_Connection = yes"
Dim objCon As New SqlConnection(conStr)
Dim obj As SqlCommand
Dim strSQL As String
' Create the database
objCon.Open()
obj = objCon.CreateCommand()
strSQL = "CREATE DATABASE INDRA"
' Execute
obj.CommandText = strSQL
Try
obj.ExecuteNonQuery()
MsgBox("Database Created Successfully...", MsgBoxStyle.Information, "Indranil Chatterjee..")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
objCon.Close()
'CREATING TABLE............
Dim conStr1 As String = "Server=.;Database=INDRA;Trusted_Connection = yes"
Dim objCon1 As New SqlConnection(conStr1)
Dim obj1 As SqlCommand
Dim strSQL1 As String
objCon1.Open()
obj1 = objCon1.CreateCommand()
strSQL1 = "CREATE TABLE Indra (ID INT IDENTITY PRIMARY KEY,FirstName VARCHAR(30), LastName VARCHAR (30),Email VARCHAR(30),PhoneNo VARCHAR (15))"
' Execute
obj1.CommandText = strSQL1
Try
obj1.ExecuteNonQuery()
MsgBox("Table Created Successfully...", MsgBoxStyle.Information, "Indranil Chatterjee..")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
objCon1.Close()
objCon1 = Nothing
Me.Hide()
Form2.Show()
Please tell me where i put the above said quieries in the form.
Please help me sir.......
Indranil
hspl
21-Jan-13 11:18am
View
Ok Sir........let me create the form along with database.....then i will give you what i create, than we move....
hspl
21-Jan-13 10:44am
View
Actually i want to do...
I want to issue advance to employee and this advance will be deducted from his salary by the MONTH he want to refund his advance for example :-
If the employee X has taken advance in the month of January 2012 and he wants to return his advance in installments by the month of MARCH (NOT FROM THE MONTH OF JANUARY OR FEBRUARY) 2012. What I wanted to do that when the salary of the Mr. X is being generated for the month of MARCH 2012 the software should start deducting installment amount from his salary from the month of MARCH 2012 till his advance becomes 0
Please help me on above problem.....how to design my form as well as database etc.
hspl
21-Jan-13 9:43am
View
Sir...below i want to do....
i want to generate months after selecting the month form combobox(i changed it from textbox)say in combobox i select JANUARY, and amount of payment in Amt_pay textbox, the logic is if x member take loan and want to repay it from January till it loan becomes 0.
hspl
21-Jan-13 9:21am
View
Sorry sir.....i am unable to solve....thanks for your helps.
hspl
21-Jan-13 9:20am
View
Deleted
Sorry sir.....i can't able to solve....thanks for your helps.
hspl
21-Jan-13 8:08am
View
Ok, but were i will use this below statement by which i save the record in database
Dim [date] As String = "February"
Dim addMonths As String = "4"
Dim dt As DateTime
If DateTime.TryParseExact([date], "MMMM", CultureInfo.InvariantCulture, DateTimeStyles.None, dt) Then
Dim i As Integer
If Integer.TryParse(addMonths, i) Then
dt = dt.AddMonths(i)
...
End If
End If
hspl
21-Jan-13 7:34am
View
Thanks again for your reply, i want to give you the details about my database please help me.........
Using ms access database name indra.mdb, where i used a LOAN table the details are given below :-
Code,Mem_Id,Mem_Name,Dt_Loan,Loan_Amt,Month_LoanPay,Amt_Pay,Period.
This the details now please tell me how can i save the record in database.
hspl
21-Jan-13 6:43am
View
Thanks sir for your solution, if you don't mind can tell me how can save the above record in database
hspl
15-Jan-13 8:41am
View
Sir,
I want to create lan appliaction in vb.net with sql server database.
How can i use .ini file to connect the database in vb.net application.
hspl
15-Jan-13 6:10am
View
Dear Sir,
I could not understand the said solution2.Can you please provide me sample application if possible......
Show More