Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Public Function Pagebind(ByVal pg As Integer)
Dim nor As Integer
Dim repcol As Integer
nor = DropDownList1.SelectedValue
If (nor <= 4) Then
repcol = nor
repcol = nor / 2
DataList1.RepeatColumns = repcol
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.ConnectionStrings("testConn").ConnectionString
Dim cmd As New SqlCommand
cmd.CommandText = "paging"
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@pagenumber", SqlDbType.Int).Value = pg
cmd.Parameters.Add("@pagesize", SqlDbType.Int).Value = nor
Dim dr As SqlDataReader
dr = cmd.ExecuteReader()
Dim tot As Int32
tot = dr(0)
Label1.Text = pg.ToString()
Label2.Text = "of"
Label3.Text = Convert.ToInt32(tot / nor).ToString
Dim i As Int32
Dim ar As New ArrayList
For i = 1 To Convert.ToInt32(Label3.Text)
DataList2.RepeatColumns = ar.Count
DataList2.DataSource = ar
If (dr.NextResult()) Then
DataList1.DataSource = dr
Button1.Enabled = True
Button2.Enabled = True
Button3.Enabled = True
Button4.Enabled = True
If pg = 1 Then
Button1.Enabled = False
Button2.Enabled = False
If pg = Convert.ToInt32(Label3.Text) Then
Button3.Enabled = False
Button4.Enabled = False
Protected Sub DataList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataList2.SelectedIndexChanged
Pagebind(DataList1.SelectedIndex + 1)
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Pagebind(Convert.ToInt32(Label1.Text) - 1)
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Pagebind(Convert.ToInt32(Label1.Text) + 1)
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
CREATE PROCEDURE paging
@parameter1 int = 5,
@parameter2 datatype OUTPUT
declare @srec int
declare @erec int
declare @spid int
declare @epid int
declare @rc int
declare c_prd scroll cursor for
select productid from products order by productid
fetch absolute @srec from c_prd into @spid
select @rc=count(*) from products
if @rc < @pagesize
set @erec=@pagenumber * @pagesize
fetch absolute @erec from c_prd into @epid
select count(*) from products
select productname,unitprice,categoryname from products a ,categories b
/* SET NOCOUNT ON */
I need your suggestion, I have created an Windows service to mointer my mail id, it stores the content of the mail in the data base. I want to install my service in an remote system. I dnt know how to do it.
Plz suggest me how to install it in remotew machine........
-go to visual studio command prompt
-installutil -i [path of that service i.e exe]
This command will install the service in windows services
Depending on the start mode i.e Automatic,manual the service is started
I need to do the same that is remote installation of windows service . But i need to do this with setup .I need to create setup with automatically installs win service on remote system. Need to do by asp.net /C#
-For that you need to create a batch file i.e same command copy in to notepad and save as .bat extn.
-Make sure that service path is given properly in batch file.
-In the setup project add this batch file so that it will execute first
before starting installation of your actual web project.
-connect to remote system using vpn client(remote desktop connection),
-once you connected you will get the gui of that remote machine at your pc
-carry this setup file from your pc to remote machine using ftp server
-run the setup in the remote machine
I have drop just one WebPartManager Control on page, and i am getting following error message, eventhough i did not write any code.
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I wonder if I can make a webservice work via a desktop application in which this webservice manipulates a web application (for example change a label) ?
Lets me explain in detail. I want to click a button on my destop application (which is currently viewing a web application) and this will make a webservice start to work. This webservice -then- will change a label on the web applications.
Here I had a Dropdnlist and i need to extract the datavaluefield from the list and i have to insert in some other table.My code is...
Dim dt As SqlCommand
dt = New SqlCommand("Select CustomerId,CustName from Customer", dbconn)
sedr2 = dt.ExecuteReader()
ctList.DataSource = sedr2
ctList.DataTextField = "CustName"
ctList.DataValueField = "CustomerId"
cmdins = "Insert into Dept(CustomerId,Deptname)values(" &dtlist.DataValueField& ",'"& TxtBox1.text&"')
This is not giving any eror,but no CustomerId value is inserting into the Table,where i have to close the datareader,and how to retrive the customerid value for insertion.Help me.Thanks in advance.
But it is not taking the value.It is taking by defult the first Listitem value,not the selected one.what is the wrong?
Dim dtsl As SqlCommand = New SqlCommand("Select CustomerId from Customer where CustName='" & DtList.SelectedItem.Value.ToString() & "'", dbconn)
Dim custid As Integer = dtsl.ExecuteScalar()
And i am trying to insert this custid in the insert command.whats the wrong,I tried the same before,but not working.It is taknig by defult first listitem value as 1.
It is like that only.But still the same problem is occuring.Is there any
Dim ctid As SqlCommand = New SqlCommand("Select CustomerId from Customer where CustName='" & ctList.SelectedItem.Text & "'", dbconn)
Dim custid As Integer = ctsl.ExecuteScalar()
This is also not working.It is taking by default value.Wats the wrong.It is simple but not working.
Am i need to change anywhere??
Actually what I have understood is you are binding the dropdownlist control in page load event, am I right? And then in some other event you are trying to catch the selected value of the dropdownlist control. is it so?
You just check the code for is post back because what could be a reason is that you dropdownlist control would be getting bind again prior to get the selected value.
ya ur gussing is correct,I have given the code as Aldobe given in the pageload event.I am tring to insert values in the other event.All are correct.
I am closeing the datareader in pageload (IF !page is postback).
How to get tthe exact value.Why it is not taking selectedItems's vlaue.
Last Visit: 31-Dec-99 18:00 Last Update: 30-Sep-23 14:02