Ah see I learned something new today, thank-you so much for your patience. However, I must have the wrong one because it doesn't contain any of the methods the old code is using lol.
TypeCode
Collapse
X
-
-
Ok another vb convertion messup....
if (!(input[x]==null)) <---------------
where input is a string array ...... ref string input[]
it keeps telling me it is a variable in the if statement used as a method, i understand what it is doing however i am not sure how to correct the implementation.Comment
-
[font=Arial]Below is another issue, basically everything i can work with except the [/font]
The Dim statement I am not sure what it is doing with rawFields() is this not a method of runction... it is pulled from the Utilities.Text. Parsing namespace...
[font=Arial] Private Function GetFieldArray(B yVal fileRecord As String) As Array
Dim fields As Array = Nothing
Select Case Me.FileType
Case FileFormat.Deli mited
' split the fields
Dim rawFields() As String = fileRecord.Spli t(Convert.ToCha r(Me.Delimiter) )
' recombine any with quotes
RecombineQuoted Fields(rawField s)
' remove the extra elements
ExtractNullArra yElements(rawFi elds, fields)
Case FileFormat.Fixe dWidth
Dim rawFields As New ArrayList
Dim mark As Int32 = 0
For x As Int32 = 0 To _textFields.Cou nt - 1
' extract the value and move the book mark
rawFields.add(f ileRecord.Subst ring(mark, _textFields(x). Length))
mark += _textFields(x). Length
Next[/font]
[font=Arial] fields = rawfields.ToArr ay
Case Else
Throw New ApplicationExce ption("The specified FileType is not valid.")
End Select
Return fields
End Function[/font]Comment
-
I think there were some types on that (you had two objects called rawFields and no object called _textFields)
Code:private Array GetFieldArray(string fileRecord) { Array fields = null; switch (this.FileType) { case FileFormat.Delimited: // split the fields string[] _textFields= fileRecord.Split(Convert.ToChar(this.Delimiter)); // recombine any with quotes RecombineQuotedFields(rawFields); // remove the extra elements ExtractNullArrayElements(rawFields, fields); break; case FileFormat.FixedWidth: ArrayList rawFields = new ArrayList(); Int32 mark = 0; for (Int32 x = 0; x <= _textFields.Count - 1; x++) { // extract the value and move the book mark rawFields.add(fileRecord.Substring(mark, _textFields[x].Length)); mark += _textFields[x].Length; } fields = rawfields.ToArray(); break; default: throw new ApplicationException("The specified FileType is not valid."); break; } return fields; }Comment
-
One more issue I borrowed some files from another application and brought them inhouse under the same namespace (Good Idea? Bad Idea? not sure )
but regardless I have everything working except ......
TextFieldParser tfp;
//string filePath = Path.Combine(Pa th.GetDirectory Name(Applicatio n.ExecutablePat h), "Delimited.txt" );
string filepath = myFilePath;
tfp = new TextFieldParser (myFilePath);
TextFieldCollec tion fields = new TextFieldCollec tion();
fields.Add(new TextField("Stat ion", TypeCode.String , true));
fields.Add(new TextField("Refe rence", TypeCode.String , true));
fields.Add(new TextField("Name ", TypeCode.String , true));
fields.Add(new TextField("Addr ess 1", TypeCode.String , true));
fields.Add(new TextField("Adre ss 2", TypeCode.String , true));
fields.Add(new TextField("City ", TypeCode.String , true));
fields.Add(new TextField("ST", TypeCode.String , true));
fields.Add(new TextField("ZIP" , TypeCode.Int32) );
fields.Add(new TextField("PH", TypeCode.Int32) );
fields.Add(new TextField("Alt. PH", TypeCode.Int32) );
fields.Add(new TextField("Wayb ill", TypeCode.String , true));
fields.Add(new TextField("Note s 1", TypeCode.String , true));
fields.Add(new TextField("Note s 2", TypeCode.String , true));
fields.Add(new TextField("Date ", TypeCode.String , true));
tfp.TextFields = fields;
[BOLD] tfp.RecordFaile d += new RecordFailedHan dler(tfp_Record Failed); [/BOLD]
This line throws an error no matter where it is daying "does not exist in current context" should i change the namespace back to the orginal and just include it with the using clause or is there a way to fix this as is???Comment
-
Is how you attach event handlers. This is looking for the function called "tfp_RecordFail ed" so it can use it for the RecordFailed event.Code:tfp.RecordFailed += new RecordFailedHandler(tfp_RecordFailed);
You will need to copy that function over as well.Comment
-
Thanks I am learning alot with this little project of mine,
one more question in c# what is the best way to get the ascii value of a char(x)Comment
-
[font=Arial]
Orginal VB.NET
Dim OrderNo As Integer = -1
Dim param As SqlParameter = CreateParameter ("@lNewOrderID" , SqlDbType.Int, OrderNo, ParameterDirect ion.Output)
ExecuteNonQuery ("sp_TracksOrde rs_Import", CreateParameter ("@xsDetails ", SqlDbType.VarCh ar, xmlStr, 6000), _
param)
OrderNo = param.Value
Return OrderNo
VB.NET Function
Protected Sub ExecuteNonQuery (ByVal procName As String, ByVal ParamArray paramList() As IDataParameter)
Dim cmd As SqlCommand = Nothing
ExecuteNonQuery (cmd, procName, paramList)
End Sub
problem is when i convert this to C# it is not creating a parameter list and instead goes to another fucntion that is an overload with 3 parameters.
any thoughts how to redo this in c#.. basically i just need guidence on passing it with a parameter list
i.e.
ExecuteNonQuery ("sp_TracksOrde rs_Import", parmeterlist??)[/font]Comment
-
Sorry I was referring to the function call.
ExecuteNonQuery ("sp_TracksOrde rs_Import", CreateParameter ("@xsDetails ", SqlDbType.VarCh ar, xmlStr, 6000), _
param)
This comes from a different class calling the ExecuteNonQuere y as you described above but as you can see it has or at least it thinks it has 3 parameters instead of a string and a parameter list...
this ends up going straight to another overload function ExecuteNonQuery (cmd,procname,p aramlist)
any thoughts?Comment
-
This call:
certainly seems like it fits into the (string, params[]) format to me?Code:ExecuteNonQuery("sp_TracksOrders_Import", CreateParameter("@xsDetails", SqlDbType.VarChar, xmlStr, 6000), _param)
That would call that ExecuteNonQuery (string, params IDataParameter[] myparams); function?Code:IDataParameter temp =CreateParameter("@xsDetails", SqlDbType.VarChar, xmlStr, 6000); //somewhere else another IDataParameter is defined as "param" ExecuteNonQuery("sp_TracksOrders_Import", temp,param);Comment
-
Thanks I found the problem because of that post, turns out the translator i used went and put
sqlparameter param = xxxxxx
and that was where the problem was arrising once i did it as above it corrected the problem now i have to troubleshoot the connection lol... it just never ends!!!Comment
-
Ok one more question
I am new to event handling in C# and here is the situation
I believe I have all the parts, I have the deligate named recordhandler
the class with the ations to be taken
in the class that is calling it though (rasing the event so to speak) how to i tell it to call it.
if (RecordFound != null)
RecordFound(ref currentLineNumb er, m_TextFieldSche ma.TextFields);
m_CurrentLineNu mber = currentLineNumb er;
Record found in the try block is always null even though it is doing it's thing... how do i tell it before it gets to the if statement that a record was found?
Thanks
Dale.
[/size]Comment
Comment