|
'To load in the dropdownlist in GUI
Private Sub Load_Specializaion()
Dim objInfo As New clsHrmSpecializationInfo
Dim objb As New clsHrmSpecializationBL
Try
Me.ddSplz.Items.Clear()
_objSplz = objb.GetSpecializations()'Calls the function in the BUSINESS LAYER
For Each objInfo In _objSplz
Me.ddSplz.Items.Add(New ListItem(objInfo.SPLZNAME, objInfo.SPLZCD))
Next
objb = Nothing
objInfo = Nothing
_objSplz = Nothing
Catch ex As Exception 'THIS IS WHERE THE EXCEPTION IS CAUGHT
objb = Nothing
objInfo = Nothing
_objSplz = Nothing
Throw ex
End Try
End Sub
'BUSINESS LAYER
Public Function GetSpecializations() As clsHrmSpecializationInfo()
Dim objDBSpecialization As New clsHrmSpecializationDL
Return objDBSpecialization.GetData()'Calls the function in the DATA LOGIC LAYER
End Function
'DATA LOGIC LAYER
Public Function GetData() As clsHrmSpecializationInfo()
Dim cnn As clsConn
Dim ds As DataSet
Dim dt As DataTable
Dim al As New ArrayList
Dim row As DataRow
Dim arr As Array
Dim str As String
Try
cnn = New clsConn
str = "Select * from HRM_SPLZ_AREAS "
ds = cnn.GetData(str) 'call the function in DATA ACCESS LAYER
dt = ds.Tables(0)
For Each row In dt.Rows
Dim objSplz As New clsHrmSpecializationInfo
objSplz.SPLZCD = IIf(IsDBNull(row("SPLZ_CD")), "", row("SPLZ_CD")).ToString()
objSplz.SPLZNAME = IIf(IsDBNull(row("SPLZ_NAME")), "", row("SPLZ_NAME")).ToString()
al.Add(objSplz)
Next
arr = al.ToArray(GetType(clsHrmSpecializationInfo))
Return (arr)
Catch ex As Exception
Throw ex
End Try
End Function
'DATA ACCESS LAYER
Public Function GetData(ByVal commandar As String) As DataSet
Dim ds As DataSet
Dim AD As OdbcDataAdapter
Try
If conn.State = ConnectionState.Closed Then
conn = New OdbcConnection("dsn=xxx;UID=xxx;PWD=xxx;")
conn.Open()
Dim Mysql As String
Mysql = "alter session set nls_date_format='DD/MM/YYYY'"
command = New OdbcCommand(Mysql)
command.Connection = conn
command.ExecuteNonQuery()
command = New OdbcCommand(commandar)
command.Connection = conn
Else
Dim Mysql As String
Mysql = "alter session set nls_date_format='DD/MM/YYYY'"
command = New OdbcCommand(Mysql)
command.Connection = conn
command.ExecuteNonQuery()
command = New OdbcCommand(commandar)
command.Connection = conn
End If
ds = New DataSet
AD = New OdbcDataAdapter(command)
AD.Fill(ds, "DataGrid")
AD.Dispose()
Return ds
Catch ex As Exception
Throw ex
End Try
End Function
|
|
|
|
|
OK, and if you set a breakpoint in the code and step through, which line throws it ? The SQL that you're running, what happens when you run it in the Oracle client tools ? Does it happen the first time this code is called ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi,
Did anyone can tell me how to send data to an email, here's the situation
I creating aspx page that content of three textbox and one Submit button
First textbox is use to fill Name
Second textbox is use to fill Email Address
Third textbox is use to fill Security Code
After i input all the textbox then i clik the Submit button then i want all the information in all the texbox are send to an email address (let say info@somewebsite.com)
How is the script behind that submit button
Thanks b4
Abbas
|
|
|
|
|
There's an article on how to use google here on code project. I wrote it, and I used sending emails as my example, because there's SO much info on google about it, yet people keep asking.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
hello sir
sir i am using master page in my web application.
i am using asp.net with c#.
in my webform i have some btn,text label control which is I want to use on master page.
how is it possible.
pls tell me details code.
gayatri
Gayatri
|
|
|
|
|
For using Master page you need ti knwo about ContentPage, ContentPlaceHolder.
ContentPage is your pages and contentplaceholder holds content pages.
niki_nilu wrote: in my webform i have some btn,text label control which is I want to use on master page.
you need to use this as ContetPage and give the ContentPlaceholderID in it. and use content place holder in master page.
Please Check This Link Master Page in asp.net 2.0[^]
Its very good link , where you can get basic of Master Page.
if you have any problem , ask here !!!
cheers,
Abhijit
|
|
|
|
|
Hi,
I am planning to migrate asp.net 1.1 solution to 2.0,
But, after I covert the solution to VS2005 I ended up with many errors Please suggest me the available options for me.
MY SOLUTION CONTAINS 4(FOUR)PROJECTS, Each project will depend on the another project.
and each project will have its own web.config file.
I am using a 3rd party control for UI.
and after I convert the solution to VS2005. application is not running, as its resulting error saying compiler can not find few particular .dll s.
But in 2003 the name of dll are with respect to namespaces, but in VS2005 its giving some other name and finally my code is not running...
Suggest some efficient methodology to Migrate VS2003 application to VS2005.
Thanks
|
|
|
|
|
I have this web application that displays table/data according to a query result and edits only the selected line of output if the check box 'Add' is checked. Here is my code:
Protected Sub btnEdit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnEdit.Click
Dim forms = Request.Form()
Dim item As String
Dim strRollNo, strNewInspStat, strNewInspDateM, strNewInspDateD, strNewInspDateY, strNewInspBy, strNewInspDate As String
Dim chk As String
Dim count As Integer
For Each item In forms
If InStr(item, "Hidden") > 0 Then
strRollNo = Request.Form(item)
End If
If InStr(item, "inpsStat") > 0 Then
strNewInspStat = Request.Form(item)
End If
If InStr(item, "dteMonth") > 0 Then
strNewInspDateM = Request.Form(item)
End If
If InStr(item, "dteDay") > 0 Then
strNewInspDateD = Request.Form(item)
End If
If InStr(item, "dteYear") > 0 Then
strNewInspDateY = Request.Form(item)
End If
Dim dtecastdatemonth As String
Select Case strNewInspDateM
Case "Jan"
dtecastdatemonth = "1"
Case "Feb"
dtecastdatemonth = "2"
Case "Mar"
dtecastdatemonth = "3"
Case "Apr"
dtecastdatemonth = "4"
Case "May"
dtecastdatemonth = "5"
Case "Jun"
dtecastdatemonth = "6"
Case "Jul"
dtecastdatemonth = "7"
Case "Aug"
dtecastdatemonth = "8"
Case "Sep"
dtecastdatemonth = "9"
Case "Oct"
dtecastdatemonth = "10"
Case "Nov"
dtecastdatemonth = "11"
Case "Dec"
dtecastdatemonth = "12"
End Select
strNewInspDate = dtecastdatemonth + "/" + strNewInspDateD + "/" + strNewInspDateY
If InStr(item, "inpsBy") > 0 Then
strNewInspBy = Request.Form(item)
End If
If InStr(item, "chk") > 0 Then
chk = Request.Form(item)
If chk = "on" Or chk = "1" Then
Dim rollInfo As New Inspector(fm.posConnection)
If rollInfo.updateRollInfo(strRollNo, strNewInspStat, strNewInspDate, strNewInspBy) = True Then
lblEdited.Text = "Selected Record(s) has been Edited."
Else
lblEdited.Text = "Failed to Edit Record Selected."
End If
End If
End If
Next
End Sub
Basically i want to do is check line per line(or per result set) to get the value of the controls in that line, and if the check box is checked, it will be updated using my function "updateRollInfo". It seems that my code is getting all the values for a certain control before proceeding to the next.
I hope I am making sense and somebody can help me on this, thanks in advance!
|
|
|
|
|
my code is good only the declaration is..well..bad.
i replaced my declaration to
Dim strRollNo As String = ""
Dim strNewInspStat As String = ""
Dim strNewInspDateM As String = ""
Dim strNewInspDateD As String = ""
Dim strNewInspDateY As String = ""
Dim strNewInspBy As String = ""
Dim strNewInspDate As String = ""
Dim chk As String = ""
and it's working now just the way i want it. I am just wondering why my declaration made difference?
|
|
|
|
|
I'm programming in classic ASP but I didn't see a forum for this so I post it here. I hope somebody can help me.
I have 2 tables, empID and deadEmpID. My app generates a new employee ID by getting the value of NEXTVAL (sequencial # from Oracle). The deadEmpID table contains a few numbers that we can not use as an employee ID so before inserting nextval into empID, I need to check to make sure this number is not in the deadEmpID table. When I run my program, if the new generated id is not in deadEmpID then it's fine... but if exists in deadEmpID, it keeps running until time out. What am I doing wrong here, please help!!
(When you reference the nextval from your sql statement, it increments to the next sequence # .)
getNextVal = "select emp_id_seq.nextval as NextEmpID from dual"
Do While True ' loop forever
Set oRS = oConnDB.Execute( getNextVal )
sNextEmpID = oRs("NextEmpID")
oRS.Close
' compare nextval make sure it's not in dead table
checkDead = "select deadID from deadEmpID where deadID = '" & sNextEmpID & "' "
Set oRS = oConnDB.Execute( checkDead )
If oRS.EOF Then Exit Do ' that empid not in dead table
Loop ' we'll go back and get another nextval and try again
'insert into employee table
sSQL = "insert into empID (empID, lname, fname) values (emp_id_seq.curval, '" & sLastName & "', '" & sFirstName & "')"
oConnDB.Execute(sSQL)
|
|
|
|
|
kl010705 wrote: I'm programming in classic ASP but I didn't see a forum for this so I post it here
Should have used VB Forum instead
kl010705 wrote: I have 2 tables, empID and deadEmpID
deadEmpID, nice name
Anyways, have you ever heard of break keyword. You will need to break your look once you find the new generated empid in the existing table.
Hope this helps
|
|
|
|
|
My God, I didn't really notice until you told me about the variable name!
I'll try 'break'. Thank you for your suggestion!
|
|
|
|
|
Hi guys,
In my ASP.NET website I have several custom controls which make use of the Page.ClientScript.GetPostBackEventReference method to achieve postbacks from client javascript. Up until now this has worked like a charm, however I find myself with a difficulty.
GetPostBackEventReference generates a reference which allows one control reference and one argument to be passed from the client to the server. Is there already a mechanism in place to parse multiple arguments from the client to the server?
It isn't the end of the world if there isn't because I could manually parse a single string into multiple arguments.
Many thanks!
Lea Hayes
|
|
|
|
|
Hi,
I have worked out a slightly different way of achieving what I need. Instead of manually adjusting the postback reference I have just realized that I can use hidden fields to achieve what I need.
For those interested,
1. I register the hidden field via
Page.ClientScript.RegisterHiddenField("MyFieldName", "InitialValue"); .
2. This value can then be altered by javascript
document.getElementById('MyFieldName').value = 'AdjustedValue';
3. Then this value can be retrieved again on the server by:
string requestedValue = Page.Request.Form["MyFieldName"];
And that's all there was to it!
Thanks anyhow,
Lea Hayes
|
|
|
|
|
If you want to get client values,there are four methods.
one is ViewState,two hidden control,three session,four request.query or request.form.
studing is processing in this life.
|
|
|
|
|
Hi,
Thank you for your advice...would you be able to demonstrate how to access the view state object from the client script language? I was under the impression that the view state was not accessible by the client because it is encrypted, and compressed.
I would also be interested in an example for the accessing session information via the client.
I understand how the hidden controls, request.query, and request.forms alternatives work.
Thanks!
Lea Hayes
|
|
|
|
|
In fact,ViewState is the same as Session.
button1_click()
{
ViewState["test"]=TextBox1.text;
string temp=ViewState["test"];
Response.write(temp);
}
studing is processing in this life.
|
|
|
|
|
Hi,
I am getting an exception when i am loading xml string into the XmlDocument using LoadXml()
MyCode:-
string str="<3rdperson></3rdperson>";
XmlDocument xdoc=new XmlDocument();
xdoc.LoadXml(str);
I am getting the following exception :-
System.Xml.XmlException: The '3' character, hexadecimal value 0x33, cannot begin with a name. Line 1, position 2.
|
|
|
|
|
salmonraju wrote: System.Xml.XmlException: The '3' character, hexadecimal value 0x33, cannot begin with a name. Line 1, position 2.
Didnt the exception explain the reason.
Well, keep in mind that an Xml tag can never start with an integer.
|
|
|
|
|
Thank you Manas, Is there any solution for this..
|
|
|
|
|
Hi!
There are several options you could choose:
1. Specify type of perspective as an attribute:
[This would be my personal choice because it is slightly more flexible, and it would be easy to extend the markup to include '1st' person without having to deal with additional element types.]
<person type='3rd'>
</person>
2. Use word form of '3rd':
<third-person>
</third-person>
3. Place '3rd' at end of name:
<person-3rd>
</person-3rd>
Hope that this is of help!
Lea Hayes
|
|
|
|
|
|
hi 2 all,
i am using Visual studio 2005 and Sql Server 2000.
i wanted to associte the values retrived from the database with the Radio Button List.
the Number of values retrived from Database is arbitrary.
Please explian it to me in detail,as m really new to dis field..
Thanx
|
|
|
|
|
User the datasource property of the radiobuttonlist.
once specifying the datasource, to the databind
|
|
|
|
|
hey Manas,i need to run some Sql query form the Database as well.
can i get the same in Grid View..?
pl explian bro..
thanx
Amit...
|
|
|
|