|
There isnt documentation that makes me think this will work. I used LOAD DATA INFILE a lot of times, and it works perfectly.
The problem is, I never used with ASP.NET C# coding, but MS SQL is MS SQL I just need to make the syntax right.
http://dev.mysql.com/doc/refman/5.1/en/load-data.html[^]
|
|
|
|
|
That's documentation for MySQL. My google search turned that up, too. MS SQL is NOT My SQL. I can find NO docs for INFILE in the docs that come with SQL Server, or on the web.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
My mistake.
Probably you are right. My apologies. I was seeing that like a horse with closed eyes
I already starting working on natural solution but having another problem now:
My file is for example:
field1,field2,field3
anotherfield1,anotherfield2,anotherfield3
Just works for first line. I'm really amateur on C#, how can I do read all other lines? (having also triplicated data because the use of for instead foreach, but I will solve this problem later)
string MystringLine;
string[] MystringArray;
char[] charArray = new char[] { ',' };
FileStream MyFileStrema = new FileStream("E:\\fich1.txt", FileMode.Open);
StreamReader MyStreamReader = new StreamReader(MyFileStrema);
MystringLine = MyStreamReader.ReadLine();
MystringArray = MystringLine.Split(charArray);
int tamanho;
tamanho = MystringArray.Length;
for (int i = 0; i < tamanho; i++)
{
string query;
query = "INSERT INTO Filmes(Name, Genre, Year)";
query += " VALUES ('" + MystringArray[0] + "','" + MystringArray[1] + "','" + MystringArray[2] + "')";
SqlCommand com = new SqlCommand(query, Conn);
SqlDataReader datareader = com.ExecuteReader();
datareader.Close();
}
|
|
|
|
|
If the file is well structured, perhaps you could try issuing a BULK INSERT statement to MS SQL server?
I just hit a problem where I needed to push > 200k records in multiple tables, worked in under a couple of minutes.
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
How do you ignore one specific field?
Christian Graus, thank you.
|
|
|
|
|
This is too much code.
string[] datum = File.ReadAllLines("E:\\fich1.txt");
foreach(string data in datum)
{
string [] MystringArray = data.Split(new char[] {','} );
}
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I'm reading the SQL Server books online and INFILE is not in the help. Are you sure it's supported by SQL Server ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi guys,
I've just deployed a website to a live server and i've noticed something strange is happening to the URL....
/customerportal/(S(vhjbjm55k0tuec45obi3c2am))/login.aspx
What is all the random garbage its putting in the middle?? can I turn this off?
Cheers guys!
Will
|
|
|
|
|
|
|
hi
I have this error :
Compiler Error Message: CS0118: 'System.Web.Script.Services' is a 'namespace' but is used like a 'type'
I have used a webservice for searchwebservice.and for this code htat error is shown :
Line 46: public virtual System.Web.Script.Services SearchWebService {
Line 47: get {
Line 48: return ((System.Web.Script.Services)(this.GetPropertyValue("SearchWebService")));
and don't allowed me any page runing.
please help me for solving this error is very Important.thx a lot
|
|
|
|
|
The compiler is giving you a very clear message. You are trying to use System.Web.Script.Services like a type which it is actually not. It is a namespace that contains other types.
Are you trying to use any type that is defined within that namespace ?
|
|
|
|
|
|
Hi Ersan,
If you are looking for a message box like modal popup, try to read my article: Buttons, Message Box and Confirm Box in ASP.NET 3.5[^] the code is tested and there are live demos.
It seems to me that in your example you are missing CSS styles or MS JS AJAX library was not loaded. But it could be anything. I'm sorry I don't want to debug your friends code . From the first sight it seems to me ok
Petr Pechovic
|
|
|
|
|
|
hi Petr,
Sorry for bothering again and again,
MS JS Ajax library, is it supposed to be installed in VS08?
Thank you..
|
|
|
|
|
Dear all,
I have a dynamic grid, in that I have textboxes added dynamically.When I enter value in textbox1 and textbox2 in a row,the sum should be calculated and displayed in the third textbox at the time of enytering values.
I added event handler at the time of creation of text box.So the handler is getting fired at the time of databind event.But i need that handler should be raised at the time of textbox blur event.
Or else you can give your known solution.
Thanks in advance,
Srinivas Mateti
|
|
|
|
|
Basically you need javascript to handle this...
During databind do like this :
TextBox tb1 = e.item.FindControl("textbox1") as TextBox;
TextBox tb2 = e.item.FindControl("textbox2") as TextBox;
TextBox tb3 = e.item.FindControl("textbox3") as TextBox;
tb1.Attributes.Add("onblur", "javascript:return refreshValue('" + tb2.ClientId + "','" + tb3.ClientId + "');");
tb2.Attributes.Add("onblur", "javascript:return refreshValue('" + tb1.ClientId + "','" + tb3.ClientId + "');");
Now place the function in your page inside a script tag:
function refreshValue(operand, target){
try {
var value1 = parseInt(this.value);
var value1 = parseInt(document.getElementById(operand).value);
document.getElementById(target).value = (value1 + value2);
}
catch(err) {
alert(err.description);
return false;
}
return true;
}
I think this will solve the issue. Try it.
|
|
|
|
|
Thanks abhishake,
Actually here the probles is the client id. All textboxes will be added dynamically.I doent know the textbox name..I will work on your advice.
Thanks once again,
Srinivas Matetu
|
|
|
|
|
What do you mean by Dynamic controls.
Do you mean the controls will be generated inside DataList's ItemTemplate ?
Yes, you can access controls inside
ItemTemplate from codebehind just like I mentioned in my other post. You need to find the control when
ItemDataBound event executes.
<asp:Datalist....OnItemDataBound="Item_Bound" >
<itemtemplate>
<asp:textbox runat="server" id="tb1" />
</itemtemplate>
Now from codebehind :
void Item_Bound(Object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
TextBox tb1 = e.Item.FindControl("tb1") as TextBox;
}
}
Note : You must place Runat = server if you want the control to be found properly using e.Item.FindControl
Hope this clears your doubt.
"Dont forget to click "Good Answer" if it helped you"
|
|
|
|
|
I have a datalist which includes an embedded dropdownlist. The datalist is similar to a simple shopping cart. The dropdownlist is the qty required. I've been able to set the extend price etc, but I'm also trying to set the selected qty of this dropdownlist. It doesn't seem to like any embedded <%# eval()%> in the html. The qty is updated in the database and is returned. This is the html:
===================================================================
<asp:DropDownList ID="ddlQty" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlQty_Changed" >
<asp:listitem runat="server" value="1" Selected='<%# Eval("itemqty")==1 %>' />
<asp:listitem runat="server" value="2" Selected='<%# Eval("itemqty")==2 %>' />
<asp:listitem runat="server" value="3" Selected='<%# Eval("itemqty")==3 %>' />
<asp:listitem runat="server" value="4" Selected='<%# Eval("itemqty")==4 %>' />
<asp:listitem runat="server" value="5" Selected='<%# Eval("itemqty")==5 %>' />
<asp:DropDownList>
====================================================================
Error: Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.ListItem does not have a DataBinding event.
Any ideas?
For referenc, my initial C# question was on 11/5/2009.
Used C# to update the selected value while looping thru the dataset and the datalist.
modified on Thursday, November 12, 2009 3:29 PM
|
|
|
|
|
hi
I'm trying to put this aspx page in my host and run it, I've coded it using VS2010, so version of .netFrameWork is 4. But appearntly the server is running on .netFramework 3.5. so I get this error when I try to locate the page in browser:
Line 25: system.web;
Line 26: compilation debug="true" targetFrameworkMoniker=".NETFramework,Version=v4.0";
so is there anyway I can fix this or not?
thanks
Proper Prepration Prevents Poor Performance! h
|
|
|
|
|
I'm so sorry I guess that was a really stupid question to ask, since I could just choose the version when I was creating the project.
That's what an amateur does!
sorry.
Proper Prepration Prevents Poor Performance! h
|
|
|
|
|
I am sorry, but .net is not forward compatible.
i.e. you cannot run the code developed using 4.0 in 3.5.
Now, either you contact your host to provide the .net 4.0 support OR you shift project to 3.5.
|
|
|
|
|
Hi,
How i can load my project files to an iis server (not local)?
10x
|
|
|
|