5

Living in Saudi Arabia,..,,,..

by Syed Aziz ur Rahman 16. February 2005 06:30

This is not a techincal article.

Assalam O Alaikum
I was thinking to describe the change in my life pattern since last one month. I was working in a good company in Pakistan, doing my masters side by side in parallel, having a good social life untill i got an offer from one of my old office collegues. I thought a lot about changing company and country. I didnot have such kind of experience in my life, living alone away from family but i finally thought to give it a try.

I was in Riyadh after one month of job offer. I joined the company at the same day. There are peoples from different countires in my department. Some of them are from Phalistine, Jordan, Sodan but most of them are from Pakistan and India. I spent my first few days in hotel until i found a room on rent in the same apartment shared by my office collegues.

Life here is totally different from how i used to spend in Pakistan. I usually get up at 9, run to my office without breakfast, work till 1 pm, have lunch in a good Saudi or Pakistani resturant. My official timing is 6:30 but i never leave office at that time. It is 9 or 10 pm when i leave the office. I have my dinner on the way back from a good Pakistani resturant. Go home, sleep and get ready for the next day.

Weekends are not such enjoyable nowadyas. We spend the whole weekend either sleeping on beds or just doing little chores e.g. washing clothes etc. Riyadh is not a good place for social life. There are not much (or should i say NO) places to visit, not for bachelors. I am not saying that Riyadh is not developed but every thing here looks a little artificial.

Once I visited Jeddah due to some business work. It reminds me of my city Karachi. Same beach, same atmosphere. I missed my city and people a lot on that day. I passed my evening on the Jeddah beach thinking of the beaches of Karachi.

My collegues are my friend now. We work in same office, we live in same apartment. It seems that they are my family . We try to take care of each other. They always say that do some work in your spare time otherwise you will start missing your family and friends back there.

Days are passing by quickly, i got my 2nd salay slip few days back, but i want to say to my family and friends back there
”I MISS YOU ALL”

Allah Hafiz
A soul who is feeling lonely today :(, and donot know why.....

Tags:

General

0

How to generate web forms in a good way?

by Syed Aziz ur Rahman 10. February 2005 03:44

We, in our software house, use a custom build code generator (thanx to my friend Syed Umar Anis).  It generates stored procedures, and (some what intelligent) business classes using the database schema. I want to extend this generator and want it to generate web forms as well.

I was thinking about some way so that i have to do minimal work and should be a flexible solution so that it remains compatilbe with the next version of web server controls.

I started by searching how to get the XML in aspx pages i.e. when we drag and drop some control like textbox on a aspx page, its xml will automatically be generated by the visual studio. i was searching for some method that i can do it programatically e.g.

dim txtName as textbox
txtName.Id = “txtName”
txtName.Width = “250”

these lines shoule “somehow” generate xml like this
<asp:textbox id=txtName runat=server Widht=250px></asp:TextBox>

the server control has a render method but it will give the HTML like
<input type=text ......

It seems that i have to do it manually. Anybody have some good idea? OR good solutionjQuery152012277863352197138_1327390651601
Waiting for replies and searching and thinking of a solution

Allah Hafiz

 

Tags:

ASP.Net | DotNet

1

Passing Parameters to Stored Procedures

by Syed Aziz ur Rahman 20. July 2004 23:33

Reports that use stored procedures as their data source are no different than reports that use any other data source. When you open the report, it automatically calls the stored procedure, retrieves the data, and populates the report with this data. The difference between using a stored procedure and using a table is that stored procedures accept parameters as input.

When a report is designed to get its data from a stored procedure, Crystal Reports examines the stored procedure to see if it requires parameters. If so, the designer automatically creates a report parameter that corresponds to each parameter in the stored procedure. There is a one-to-one mapping of report parameters to the parameters in a stored procedure. When the report runs, the report engine takes the value of each of these parameters and automatically passes them to the stored procedure.

As you know, the user is always prompted to enter the parameters before the report can execute. Of course, you probably don't want to prompt the user for this information because your application has already done so via the user interface. To prevent this from happening, manually populate the parameter(s) via code with the information the user has already provided.

Caution! Crystal Reports can't connect to stored procedures that have output parameters defined. When attempting to do so, the report returns the error "Failed to open a rowset" and doesn?t display any data.

Listing shows how to use the viewer control to populate the paramter fields that will be passed to the stored procedure.

Private Sub SpWithViewer(ByVal UserId As String, ByVal Password As StringByVal SpParameter As String)    'Logon to the server
    Dim crReport As New CustomerSP()
    Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
    Dim crLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo()
    CrystalReportViewer1.LogOnInfo = New CrystalDecisions.Shared.TableLogOnInfos()
    crLogonInfo.TableName = "spCustomers;1"

    With crLogonInfo.ConnectionInfo
        .ServerName = "(local)"
        .DatabaseName = "Northwind"
        .UserID = UserId
        .Password = Password
    EndWith

    CrystalReportViewer1.LogOnInfo.Add(crLogonInfo)
    'Create the parameter
    Dim ParameterFields As CrystalDecisions.Shared.ParameterFields
    Dim ParameterField As CrystalDecisions.Shared.ParameterField
    Dim ParameterRangeValue As CrystalDecisions.Shared.ParameterRangeValue
    Dim spValue As CrystalDecisions.Shared.ParameterDiscreteValue

    ParameterFields = New CrystalDecisions.Shared.ParameterFields()
    ParameterField = New CrystalDecisions.Shared.ParameterField()
    ParameterField.ParameterFieldName = "@CustPattern"
    spValue = New CrystalDecisions.Shared.ParameterDiscreteValue()
    spValue.Value = SpParameter
    ParameterField.CurrentValues.Add(spValue)
    ParameterFields.Add(ParameterField)
    CrystalReportViewer1.ParameterFieldInfo = ParameterFields

    'Show the report
    CrystalReportViewer1.ReportSource = crReport

End Sub

The first half logs onto the data source with the appropriate server name, database name, and login credentials. Notice that the TableName property is the name of the stored procedure with ?;1? shown at the end of it. This is how Crystal Reports identifies the stored procedures and you have to remember to include it as part of the table name. The second half of the code creates a new parameter field, adds is to the parameter fields collection and assigns this collection to the report viewer.You can also pass parameter using the ReportDocument object

Tip: If you want to pass a NULL value to a stored procedure parameter, set the parameter's Value property to Nothing in VB.Net and null in C#.

SET NOCOUNT ON

Although this section assumes you already familiar with stored procedures, there is one statement that doesn't get much attention but is very important.

SET NOCOUNT ON

If you are working with simple stored procedures, then the majority of them consist of a SELECT statement followed by a list of tables, fields and a join method. Crystal Reports handles this type of stored procedure fine. Once you start getting into writing more complex stored procedures you will find that you often need to execute multiple SQL statements within one stored procedure. This can happen when you are using temporary tables, and updating data prior to executing the final SELECT statement.

SET NOCOUNT ON
INSERT INTO AuditLog
SELECT * FROM tblSales WHERE

In the above code, the SET NOCOUNT ON statement is commented out. Running this code will generate two output messages for each statement. They will be in the format of ?xx records affected?. This message is passed prior to the records being returned from the stored procedure. This conflicts with what the report is expecting. Thus, it doesn't use the data from the SELECT statement as its resultset. By uncommenting the first line of code, you tell the database server not to report how many records are affected. This eliminates Crystal Reports from incorrectly using these messages as part of the database. Ideally, this statement would be the first statement in every stored procedure.

HTH

 

Tags:

ASP.Net | DotNet

1

Changing Sql Connection dynamically in Crystal Reports 10 using DotNet

by Syed Aziz ur Rahman 20. July 2004 01:12

Dim

myReport As New crDB()
myReport.SetDatabaseLogon(Me.txtUserId.Text, Me.txtPass.Text, Me.txtServer.Text, Me.txtDB.Text)
Dim myLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table

For
Each myTable In myReport.Database.Tables
   myLogonInfo = myTable.LogOnInfo
   With myLogonInfo.ConnectionInfo
      .ServerName = Me.txtServer.Text
      .DatabaseName = Me.txtDB.Text
      .UserID = Me.txtUserId.Text
      .Password = Me.txtPass.Text
  End With

   Try
     
myTable.ApplyLogOnInfo(myLogonInfo)
   Catch
     
MessageBox.Show("Login Failed")
      Exit
Sub
   End Try

   'Note: The next line is only necessary for SQL Server
  
myTable.Location = myTable.Location.Substring(myTable.Location.LastIndexOf(".") + 1)
Next myTable
CrystalReportViewer1.ReportSource = myReport

A very important piece of code is the assignment of the myTable.Location property (near the end of the listing). A requirement for changing the data source of a SQL Server table is that you must also change the Location property of the Table object. The Location property is a string value that has the name of the server as part of the string. It lists the database name, the table owner and the table name. For example, it looks similar to the following:

pubs.dbo.Customers

If you leave the Location property alone and don?t overwrite it, then the report?s server and database name won?t change. Instead, you have to reset it to just the table name. By removing the database name from the string, the report has to look at the new properties you just set to get this information. Consequently, this results in the server and database changing.

The easiest change to make would be to overwrite the Location property with a string constant. For example, the following line of code would overwrite it with the ?Customers? table.

myTable.Location = "Customers"

This works fine if the report only uses one table. But when you have multiple tables, you have to get more creative because you can?t assign the same table name to every table object. Rather than use a string constant, the code parses out the table name from the Location property and reassigns it to itself. This has the effect of resetting the value, but dropping the database name and table owner from the string.

myTable.Location = myTable.Location.Substring(myTable.Location.LastIndexOf(".") + 1)

HTH

 

 

Tags:

ASP.Net | DotNet | SqlServer

0

Java script using in User Control

by Syed Aziz ur Rahman 14. July 2004 03:59

Dear All,
Let me give you an example to explain the usage of javascript in user controls. Let us suppose that u have a usercontrol in which there are 2 textboxes named txt1 and txt2 and a button called btn1 and u want to add some custom checking when the button is clicked.

Make the usercontrol. Put it in a page and see the page in IE. View the source and check the ids of the textboxes and button. You will notice that the ids are "prefixed" by some "ambigous" letters like ctl0:, ctl1 etc.

Asp.net do this prefixing in order to maintain the unique ids of the server controls. Can u think what will happen if there are 2 instance of same user control on a single page? The ids will be like clt0:txt1 and clt1:txt1 for the textbox we named txt1. This is the scenario

So the catch is when u want to use your own javascript, pass the "ClientID" attribute of the textbox to the function. For example the javascript funtion should be like

function ValidateTextBoxes(txt1, txt2)
{
//do the magic validation
}

In your code behind u will do like this
btn1.attribute.add("onclik" ."ValidateTextBoxes('" & txt1.ClientID & "'," & txt2.ClientID & "')"). Now u can easily use functions like getElementbyID and dont forget to use the parameters passed in the function.

I know that my writing capabilites is not so good. But i have tried to explain it as good as i can in this short time.

If any problems. email me and i will send you some working sample

HTH
Allah Hafiz

 

Tags:

ASP.Net

0

Create FTP and Web IIS Virtual Directory programmatically

by Syed Aziz ur Rahman 14. July 2004 03:33

Once there was a requirement in our project that user should be able to create his own website on our server by just clicking using our web application. Creating such type of wizard was not a hard task but i was thinking that if it is possible to create virtual directories in IIS “programmitically.

Then i opened my favorite webpage www.google.com  :) and start searching for a solution. Fortunately i found an article and here it is http://www.c-sharpcorner.com/Code/2002/July/CreateVirtualDirs.asp

Enjoy.

 

Tags:

DotNet

4

Dropdown control overlapping other controls.

by Syed Aziz ur Rahman 13. July 2004 06:59

The behavior of dropdown i.e.overlapping other control was always a poblem for me until i found article. It occurs because the dropdownlists in IE are Windows-rendered controls, not browser-rendered controls. Effectively, all browser-rendered controls go on one layer, and the Windows-rendered controls go on their own, higher layer.

Read this article and enjoy
http://www.wwwcoder.com/main/parentid/36/site/2245/68/default.aspx

 

 

Tags:

ASP.Net

Powered by BlogEngine.NET 2.5.0.6
Original Design by Laptop Geek, Adapted by onesoft