Click here to Skip to main content
15,887,027 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: .txt to SQL (MS SQL Server) Pin
Christian Graus11-Nov-09 9:29
protectorChristian Graus11-Nov-09 9:29 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Maxdd 711-Nov-09 9:44
Maxdd 711-Nov-09 9:44 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Christian Graus11-Nov-09 9:49
protectorChristian Graus11-Nov-09 9:49 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Maxdd 711-Nov-09 9:56
Maxdd 711-Nov-09 9:56 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Christian Graus11-Nov-09 10:10
protectorChristian Graus11-Nov-09 10:10 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Maxdd 711-Nov-09 10:22
Maxdd 711-Nov-09 10:22 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Christian Graus11-Nov-09 11:18
protectorChristian Graus11-Nov-09 11:18 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Maxdd 711-Nov-09 11:36
Maxdd 711-Nov-09 11:36 
My mistake.

Probably you are right. My apologies. I was seeing that like a horse with closed eyes Roll eyes | :rolleyes:

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 <= MystringArray.GetUpperBound(0); i++)
for (int i = 0; i < tamanho; i++)
{
    //            Response.Write(MystringArray[0]);
    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();

}

GeneralRe: .txt to tSQL (MS SQL Server) Pin
MidwestLimey11-Nov-09 11:39
professionalMidwestLimey11-Nov-09 11:39 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Maxdd 711-Nov-09 12:02
Maxdd 711-Nov-09 12:02 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Christian Graus11-Nov-09 11:40
protectorChristian Graus11-Nov-09 11:40 
GeneralRe: .txt to tSQL (MS SQL Server) Pin
Christian Graus11-Nov-09 9:52
protectorChristian Graus11-Nov-09 9:52 
Questionasp.net strange url problem? any ideas guys! Pin
wbjohnson11-Nov-09 8:50
wbjohnson11-Nov-09 8:50 
AnswerRe: asp.net strange url problem? any ideas guys! Pin
Petr Pechovic11-Nov-09 9:04
professionalPetr Pechovic11-Nov-09 9:04 
GeneralRe: asp.net strange url problem? any ideas guys! Pin
wbjohnson11-Nov-09 9:22
wbjohnson11-Nov-09 9:22 
QuestionError:CS0118 :System.Web.Script.Services' Pin
sh_donya11-Nov-09 7:42
sh_donya11-Nov-09 7:42 
AnswerRe: Error:CS0118 :System.Web.Script.Services' Pin
Shameel12-Nov-09 7:19
professionalShameel12-Nov-09 7:19 
QuestionModalPop_up Pin
Ersan Ercek11-Nov-09 6:55
Ersan Ercek11-Nov-09 6:55 
AnswerRe: ModalPop_up Pin
Petr Pechovic11-Nov-09 7:35
professionalPetr Pechovic11-Nov-09 7:35 
GeneralRe: ModalPop_up Pin
Ersan Ercek11-Nov-09 8:27
Ersan Ercek11-Nov-09 8:27 
GeneralRe: ModalPop_up Pin
Ersan Ercek12-Nov-09 0:13
Ersan Ercek12-Nov-09 0:13 
QuestionDynamic text box Pin
sris 42611-Nov-09 6:42
sris 42611-Nov-09 6:42 
AnswerRe: Dynamic text box Pin
Abhishek Sur11-Nov-09 6:55
professionalAbhishek Sur11-Nov-09 6:55 
GeneralRe: Dynamic text box Pin
sris 42611-Nov-09 7:00
sris 42611-Nov-09 7:00 
AnswerRe: Dynamic text box Pin
Abhishek Sur11-Nov-09 11:57
professionalAbhishek Sur11-Nov-09 11:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.