 |
| ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 18th, 2011, 06:04 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Why do you keep posting the same code over and over again?
Quote:
|
what is the method that i can delete the particular selected records
|
Did you follow the three steps I mentioned above?
Imar
|
|

July 18th, 2011, 06:40 AM
|
|
Authorized User
|
|
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
to update in gridview
hey thanks dr i did all the procedures to said now its working can u just tell me how can i update the checkbox list and the textbox by using the same datakeys how can my checkbox list will get update if there are around 5 to 6 checkbox in a list
please help me out
|
|

July 18th, 2011, 07:40 AM
|
|
Authorized User
|
|
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
not able to update gridview
Protected Sub GridviewOdin_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridviewOdin.RowUpdating
Try
Dim Service_ID As String
Service_ID = GridviewOdin.DataKeys(e.RowIndex).Value.ToString
myconnection.ConnectionString = sqlConStr
mycommand = New SqlCommand("sp_ServiceUpdt", myconnection)
myconnection.Open()
mycommand.CommandType = CommandType.StoredProcedure
mycommand.Parameters.Add("@Service_ID", SqlDbType.Int).Value = Convert.ToInt32(Service_ID)
mycommand.Parameters.Add("@Service_Name", SqlDbType.NChar, 100).Value = txtServiceName.Text
mycommand.Parameters.Add("@NSE", SqlDbType.Bit).Value = Convert.ToBoolean(chkExchange.SelectedItem.Value.T oString)
mycommand.Parameters.Add("@BSE", SqlDbType.Bit).Value = Convert.ToBoolean(chkExchange.SelectedItem.Value.T oString)
mycommand.Parameters.Add("@NSE_FO", SqlDbType.Bit).Value = Convert.ToBoolean(chkExchange.SelectedItem.Value.T oString)
mycommand.Parameters.Add("@MCX", SqlDbType.Bit).Value = Convert.ToBoolean(chkExchange.SelectedItem.Value.T oString)
mycommand.Parameters.Add("@MCX_SX", SqlDbType.Bit).Value = Convert.ToBoolean(chkExchange.SelectedItem.Value.T oString)
mycommand.Parameters.Add("@NCDEX", SqlDbType.Bit).Value = Convert.ToBoolean(chkExchange.SelectedItem.Value.T oString)
mycommand.Parameters.Add("@NSE_SX", SqlDbType.Bit).Value = Convert.ToBoolean(chkExchange.SelectedItem.Value.T oString)
mycommand.Parameters.Add("@Manager_1", SqlDbType.Bit).Value = Convert.ToBoolean(chkServer.SelectedItem.Value.ToS tring)
mycommand.Parameters.Add("@Manager_2", SqlDbType.Bit).Value = Convert.ToBoolean(chkServer.SelectedItem.Value.ToS tring)
mycommand.Parameters.Add("@MIS_101", SqlDbType.Bit).Value = Convert.ToBoolean(chkServer.SelectedItem.Value.ToS tring)
mycommand.Parameters.Add("@MIS_102", SqlDbType.Bit).Value = Convert.ToBoolean(chkServer.SelectedItem.Value.ToS tring)
mycommand.ExecuteReader()
myconnection.Close()
GridviewOdin.EditIndex = -1
Bindgrid()
Catch ex As Exception
Response.Write(ex.Message)
End Try
End Submy stored procedure is as follows--
CREATE PROCEDURE sp_ServiceUpdt
@Service_ID int,
@Service_Name nchar(100),
@NSE bit,
@BSE bit,
@NSE_FO bit,
@MCX bit,
@MCX_SX bit,
@NCDEX bit,
@NSE_SX bit,
@Manager_1 bit,
@Manager_2 bit,
@MIS_101 bit,
@MIS_102 bit
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
update tbl_Service
set
Service_Name =@Service_Name,
NSE = @NSE,
BSE = @BSE,
NSE_FO =@NSE_FO,
MCX= @MCX,
MCX_SX = @MCX_SX,
NCDEX = @NCDEX,
NSE_SX = @NSE_SX,
Manager_1 = @Manager_1,
Manager_2= @Manager_2,
MIS_101=@MIS_101,
MIS_102=@MIS_102
where Service_ID = @Service_ID
select * from tbl_Service
end
i am getting a error that String was not recognized as a valid Boolean.
Last edited by priti2010; July 18th, 2011 at 09:14 AM..
|
|

July 18th, 2011, 10:49 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I am sorry, but I don't think I can help you anymore. I realy tried hard, but asking the same questions over and over and over and over and over again (post relevant code, provide a clear problem description, tell us what the debugger tells you, tell us where the code crashes, post the relevant code, explain what you're doing, post the relevant code) gets boring after a while.
Sorry it didn't work out.
Imar
|
|

July 20th, 2011, 04:43 AM
|
|
Authorized User
|
|
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
how can i avoid duplicate records to get add or update in a table
how can i make a stored procedure to check the duplicate records present or not while inserting and updating records
|
|

July 20th, 2011, 08:28 AM
|
|
Authorized User
|
|
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
CREATE PROCEDURE sp_ServiceRcds
-- Add the parameters for the stored procedure here
(@Service_Name nchar(100),
@Otputs nchar(50) output)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @result nchar(50)
IF EXISTS (select * from tbl_Service where Service_Name = @Service_Name)
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET @result = 'Records Already exits'
END
ELSE
BEGIN
INSERT into tbl_Service(Service_Name) values(@Service_Name)
-- Insert statements for procedure here
SET @result ='Records Added'
END
END
this is my stored procedure now how can i co-relate with the other insert procedure and update procedure to avoid duplicacy of records
|
|

July 21st, 2011, 12:47 AM
|
|
Authorized User
|
|
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
duplicates records
how can i call the procedure to check the duplicate records present in table while adding or updating the table
|
|

August 2nd, 2011, 04:52 AM
|
|
Authorized User
|
|
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
to avoid duplicate records
can any one tell me how can i avoid duplicate records not to save in gridview and if match is found show error of duplicates record found
|
|

August 5th, 2011, 03:07 AM
|
|
Authorized User
|
|
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Check Duplicate Record while adding new records
to check duplicate record while entering new record
Dim myconnection as New SqlConnection
Dim str As String = "SELECT COUNT(*) FROM <tablename> WHERE LTRIM(RTRIM(parameter))='" & textbox1.Text.Trim & "'"
mycommand = New SqlCommand(str, myconnection)
Dim mCount As Integer = mycommand.ExecuteScalar()
If mCount = 0 Then
write insert query
else
Label1.text= "Duplicate match"
end if
|
|

August 10th, 2011, 07:37 AM
|
|
Authorized User
|
|
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
error while updating same records
Dim str As String
str = String.Empty
Dim Service_Name As String
Dim colindex As Integer = 1
Service_Name = DirectCast(GridviewOdin.Rows(e.RowIndex).FindContr ol("Service_Name"), TextBox).Text
str = "SELECT COUNT(*) FROM tbl_Service WHERE LTRIM(RTRIM(Service_Name))='" & Service_Name & "'"
mycommand = New SqlCommand(str, myconnection)
Dim mCount As Integer = mycommand.ExecuteScalar()
'myconnection.Close()
If mCount = 0 Then
update procedure
else
MsgBox("Duplicate Service Found", MsgBoxStyle.OkOnly, "")
end if
This above is my query i cant update the grid with the same record present in the grid but if i update new records it will check and update but existing records cannot be update in the same row
how can i solve this error
|
|
 |