Global Import / Using Aliasing In .NET?
Mar 19, 2010
Using import aliasing in one file/class, we can reference class library namespaces by assigning our own custom alias like this:
' VB
Imports Db = Company.Lib.Data.Objects
// C#
using Db = Company.Lib.Data.Objects;
And then we are able to reference the classes inside of Company.Lib.Data.Objects by using the Db alias that we assigned.
Is it possible to do this at the global level so that the alias is applied to the entire solution instead of just one file/class?
Currently, we are working with web applications, so I was hoping we could add something to web.config, but I am also interested in whether or not this is possible with windows forms, console apps, and/or class libraries.
View 2 Replies
Similar Messages:
May 31, 2010
I have added global.asax file in my webservice project. in webservice project i have one class file name as 'Class1.vb' in this class contain some methods() , i want to access those methods from 'class1.vb' in global.asax.vb file. any body knows how to access those methods in global.asax.vb. file
View 5 Replies
Apr 23, 2010
I have a data import page where I start the Import by clicking a button.Second by second I want to print in Web Page informations about record is being importing.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="CurrentTimePanel" runat="server">
<ContentTemplate>
<asp:Label ID="CurrentTime" runat="server" Text="Now: " />
[code]...
View 5 Replies
Feb 8, 2011
I know there is a couple answered questions on here regarding "request scoped" globals, but I want to nit-pick on something specifically and maybe squeeze some extra enlightenment out of one or two of you.I have an ASP.NET C# Website and a static Dictionary of objects (loaded from DB once on Application start). Each page request will need to do a lookup in the Dictionary (based on a key derived from the request url/etc) and get the appropriate object.The issue is I'm trying to maximize efficiency by reducing the lookups to the Dictionary per Request. Doing just a single lookup within a Page itself is easy enough and I can pass the object to sub controls, etc too.. but global.asax is separate from the Page and it also needs to use the object (in Application_BeginRequest and Session_Start).
So is doing a Dictionary lookup once in Application_BeginRequest, once (when necessary) in Session_Start and once in the Page negligible speed wise, even if there are many requests coming in every second?I would like it if I could just have a Request scoped global variable that I can easily call upon.. the only one I see available though is HttpContext.Current.Items and that is a Dictionary itself.Am I beingridiculously nit-picky with my concern over efficiency? or will these milliseconds (nanoseconds?) get me in the long run when more and more requests are being made?
PS. I currently only have around 100 objects in the Dictionary although this may increase in the future.
View 2 Replies
Feb 17, 2011
Possible Duplicate: How to read a csv file into a .net datatable. I have a problem in my project, where I am trying to read data in a csv file, I want to convert this data to a datatable. How can I do this?
System.Data.Odbc.OdbcConnection conn;
DataTable insDataTable = new DataTable();
System.Data.Odbc.OdbcDataAdapter da;
string folder = files.FullName;
string file = System.IO.Path.GetFileName(fUpload.PostedFile.FileName);
conn = new System.Data.Odbc.OdbcConnection(@"Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + folder + ";Extensions=asc,csv,tab,txt;Persist Security Info=False");
da = new System.Data.Odbc.OdbcDataAdapter("select * from [" + file + "]", conn);
da.Fill(insDataTable);
It gives an error like :
ERROR [42S02] [Microsoft][ODBC Text Driver] The Microsoft Jet database engine could not find the object 'test.csv'. Make sure the object exists and that you spell its name and the path name correctly. I am checking there is a file 'test.csv' and the file path is correct
View 1 Replies
Aug 3, 2010
I just finished installing SiteFinity 3.7 standard version on windows server 2008. Is there a way to entirely/partially import an already existing .NET project (ASP.NET) into SiteFinity with some minor changes in the code of course (may be by changinf a couple of xml files or something similar). I could only see an "export" under Administration->Tools section but no import.
View 2 Replies
Oct 21, 2010
So I'm in the process of writing an ASP.NET application that requires to import users from a PHP application. The passwords were hashed using MD5 into the database, so the user table records looks more or less like this:
user Password
user1 827ccb0eea8a706c4c34a16891f84e7b
user2 e10adc3949ba59abbe56e057f20f883e
And so on. I have access to the PHP source code and I can see that there is no salt or anything else, it is juts a straight MD5 application. Now, Back on my ASP.NET, I tried to use MD5 using the following logic:
[Code]....
Problem is, that is returning strings like 50-F8-4D-AF-3A-6D-FD-6A-9F-20-C9-F8-EF-42-89-42, which of course is not going to match with the information in the database. What should I do so I don't have to reset 500+ user passwords?
View 2 Replies
Apr 10, 2010
I need to save the contents of div tag as an image , in other words i want to import a div to an image.
View 8 Replies
Jul 14, 2010
this started out as a pretty simple task to import a customers data into our database. The script below loads all the data into memory and then allow manipulation after.
string ConString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="" + FileLoc + ""; Extended Properties="text;HDR=Yes;FMT=Delimited(,)"";
using (OleDbConnection conn = new OleDbConnection(ConString))
{
using (OleDbCommand cmd = new OleDbCommand("SELECT * FROM DataInput.csv", conn))
{
conn.Open();
using (OleDbDataReader dr = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
{
int RowNumber = 0;
while (dr.Read())
{
if(RowNumber==0)
{
for (int i = 0; i < dr.FieldCount; i++)
{
TitleData.Add(new CSVTitleData() {ColumnID = i,ColumnName = dr.GetValue(i).ToString()});
}
}
else
{
var DataToInsert = new List<CSVData>();
for (int i = 0; i < dr.FieldCount; i++)
{
if (i == 8)
{
var A = dr.GetValue(i);
Console.WriteLine(A.GetType().ToString() + " - " + i);
}
DataToInsert.Add(new CSVData(){ColumnID = i,Value = dr.GetValue(i).ToString()});
}
Content.Add(DataToInsert);
}
RowNumber++;
}
}
}
}
This works fine until there is data like
4950
4951
4952
4998
2024
4176
7025-1
RVAC010
RVAC011
4945
4946
4947
4948
Excel tries to be clever and reads each of the fields as an Int. Resulting int the ones with a letters in being read as DBNull. Now I've done some reading and there are lots of people with this question but no solid solution. One of the possible solutions is to create a Scheme.ini I wonder if someone can help me out with the exact format of that? Or perhaps there is an easier was of reading in the CSV?
View 3 Replies
Apr 18, 2010
I just downloaded Microsoft visual web developer 2010, and i don't have any special experience. I want to do something very simple, but it seems like i can't find the right tool. I am looking for the web browser tool all over the toolbox, but i can't find it. You see how in visual basic there is a web browser, you just drag it and use it.
[code]...
View 12 Replies
Feb 23, 2010
I have a site in development which has a sitemaster page and a number of webform (.aspx pages). I have setup a namespace within APP_Code folder which contains a nested name space 'SQL' which will contain all of my connection logic etc. Within the SQL namespace I have created a class named dbconnection; contained within is a method called connect: connect(String table, String query). Within this method I have opened a connection be cautious to use a try catch error handling block. Within the catch block I am trying to connect to an ASP:Label element within my sitemaster page but it just keeps coming up with the familiar 'not in the current context' error message. I presume I have to connect the namespace within app_code to my sitemaster..
View 2 Replies
Apr 26, 2010
method to import contacts in address book from AOL, HotMail, Gmail, Yahoo and Rediffmail?
View 3 Replies
Sep 8, 2010
I'm currently struggling with this problem:
- I currently using Microsoft Visual Studio 2008 and the extension for my database in my web application is .mdf
- My supervisor gave me two files, student.txt and staff.txt
- I needed to import both of these files into my web application and I am new to this language and I have no idea on how to do this.
View 7 Replies
Dec 8, 2010
I have creat asp project and add existing file TokenProcessor.cs. In TokenProcessor.cs file is function which need to call in my asp file, but then i use <%@ Import Namespace="TokenProcessor" %> he find a erorr that :"A using namespace directive can only be applied to namespaces; 'TokenProcessor' is a type not a namespace" So maybe there are other ways?
View 2 Replies
May 9, 2010
I have a csv file and I want to be able to open it remove two colums and save it back as a cvs by clicking on one button.
View 3 Replies
Sep 27, 2010
i am trying to create a import package to import data from a CSV file. When I create a flat file source and take a look at the preview I see that the fields are mixed up. Some fields are ok, but quet a few arent. When I open the CSV in excel or a other program it looks good, all rows are ok. When i import the CSV in access it is also ok. So I'm a bit confused where the problem lies. all the settings are standard. The strangest thing is that when i replace al the semicolons to for instance tab's the problem keeps.
View 4 Replies
Dec 6, 2010
What's the best way to import a small csv file into SQL Server using an ASP.NET form with C#? I know there are many ways to do this, but I'm wondering which classes would be best to read the file and how to insert into the database. Do I read the file into a DataTable and then use the SqlBulkCopy class, or just insert the data using ADO.NET? Not sure which way is best. I'm after the simplest solution and am not concerned about scalability or performance as the csv files are tiny. Using ASP.NET 4.0, C# 4.0 and SQL Server 2008 R2.
View 1 Replies
Sep 24, 2010
how we can acheive this. I need to import this excel file. This is a sample image. I have no. of header rows and no. of columns will differ in each header.
Here is another information about the excel file. Col cells are set with background color. IS there any way to read the values from the cells having background color
View 1 Replies
Nov 12, 2010
I'm writing a reporting tool that, as a starting point, needs to create a DB table from a csv file. This csv file will have been created from exporting data from our old system (with the new system being the reporting tool) and can have up to 300 columns of data. I've been trying as follows:
[Code]....
but am finding that only the first 255 columns get put in. I am assumg that the Jet driver is the one that is limiting the columns, or is there a registry setting somewhere that'll solve it quickly?
Is there another approach that'll work? I've though of the following, but as it'll take a while to recode and test each time I thought I'd ask the experts first!!
BULK INSERT: would mean that I'd need to pre-create the table first, but if the issue is with the Jet driver I'd surely get the same problem? Use a datatable: it seems pretty fiddly and probably a lot slower, but I guess I could read into a dataset and then bind that to a table to insert? Again the table would need to exist and the driver that I use to read from the csv would be the issue? Do it one row at a time in a loop in the code: assuming I can read the file as text, I could then split the data in code into an array and create a insert statement (again to an existing table) for each row. With what could be 1000s of rows I can't imagine that this is the fastest solution!
View 2 Replies
Jan 5, 2011
I m using VS.NET 2010 and i would like to use LINQ. how to import LINQ to my console application or any application?
View 3 Replies
Oct 8, 2010
I need to import a pdf file into a web app and read it's column and then save them into database.
What would be the best way to read a pdf table by importing a file and save it in sql server?
View 2 Replies
Jun 30, 2010
how to import messengers into asp.net page?
View 3 Replies
Aug 31, 2010
i m having excel file a.xls i m having gridview1,fileupload1 how to import excel file from fileupload1 get the destination of a.xls and show the values in gridview1
View 3 Replies
Oct 7, 2010
I have been trying to import from an Excel file and insert it into a table. I can upload the Excel file. I can view the Excel file in a grid But when I run the import process to insert the rows in the Excel file I get only one row and it has all nulls except the dateentered and entered by field. I added breakpoints and tried setting a couple of the fields to labels and I could see that data was getting to the reader.
View 4 Replies
May 29, 2010
instead of using gridview to insert student marks (I have hundreds of students) thought I used the Excel:
1) allow managers of each module after authentication to download the excel file (containing the students enrolled in the given module), the excel file ted is generated by the following code: Id_student ____ maks of subject1 -------- ----maks of subject2
[Code]....
But in this code I do not know how to:
* Add the following condition: the student'marks is between 0 and 20.
* Calculate the average of this module : sum (coeff * mark) / sum (coeff)
2) Allowing responsable module send me the file containing the data (but then I do not know how)
3) Using data, by sending them to the database to calculate averages.
View 3 Replies