Storing A Paragraph In Sql Server

Apr 24, 2006

I want to store a multipul paragraphs of information into one field in sql server.  It works fine but when I output to html the writing does not have the paragraphs and all the text goes together like one big paragraph.

 

 

View 3 Replies


ADVERTISEMENT

Storing Paragraph

Mar 19, 2008

 Hi All,Does anybody know how i can store a paragraph with spaces, newline, empty lines in a sql server 2005 database table? What data type should i declare the table entry to take? I will also like to retrieve the data with what ever i would have stored it with.

View 6 Replies View Related

Paragraph In Nvarchar Field

Mar 1, 2008

i'm having following:


create table tbl_text
(id int,
sometext nvarchar(max)
)

insert into tbl_text (id, sometext) values (1, 'I have here paragraph
and here is another one,
and another
and another')


how can i tell sql server 2005 to give use all the paragraphs within sometext field?

View 5 Replies View Related

How To Retain Text And Paragraph Formatting

Aug 17, 2007

Is it possible to retain text or paragraph formatting in a SqlServer 2005 Express edition table? If so, how?

I am particularly interested in keeping a linebreak between paragraphs and the only way I can think to do that is to put each paragraph in its own row. But I want some input before I undertake that substantial task.

Thanks for any help provided.

View 7 Replies View Related

How To Search Specific Word Present Multiple Times From A Paragraph Using Asp.net 2.0

Apr 16, 2008

Anyone please suggest me that
How to search specific word present multiple times from a paragraph stored in sqlserver database  using asp.net 2.0
 With Regards
Tapan

View 4 Replies View Related

Which Is Better? Storing Data In The Database OR Storing It In The File System

Dec 29, 2006

Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?    

View 6 Replies View Related

SQL Server Storing As �

Oct 20, 2004

My forms are taking user input, then HtmlEncoding them prior to being stored in the SQL DB. For some reason, SQL is storing quotes as � and it is causing the HTML when decoded in the page to not be rendered properly.

Has anyone come across this issue before?

For example (without encoding for readability):

SQL should store the parsed string as: <a href="someurl" class="main">

but for some reason it's being stored as: <a href=�someurl� class=�main�>.

Thoughts?

View 2 Replies View Related

Storing Articles In SQL Server

Oct 25, 2007

Hello Everyonen and thanks for your help in advance.  I am developing a conetnet management system to allow for the storage of articles within a SQL Server 2000 database.  I am using FreeTextBox as the editor for users to enter articles.  I ahve two questions.  First, many of the articles are quite lengthy and including HTML formatting go well beyond 8000 characters.  How should I go about storing these articles?  Should I use a TEXT datatype, or perhaps split the data into more than one row.  This leads to my second quuestion.  Many sites that display article type data break the artilce into multiple pages with page numbers or next links to page back and forth.  I am not sure hot to go about implmeneting this.  Any help on this topic would be greatly appreciated.  Thanks.

View 3 Replies View Related

Storing Session In SQL Server

Oct 4, 2004

I have some C# code that iterates through the session state, serializes each object and stores the binary representation in an SQL table with an 'image' column. The problem is: it doesn't work. SQL server doesn't throw an error (at least ADO.NET doesnt propagate it); the table is just left unchanged. The SP works (I tested it with a few simple values); the MemoryStream and byte array are being populated correctly and bound to the parameter correctly.

What am I doing wrong? Anyone have a better approach? I know there is a builtin way of storing state in an SQL server, but I only need to do this once--namely, when a user is redirected from non-secure to secure pages--so I don't want to take that performance hit,


string uid = _session.SessionID;
object toSerialize;
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream stream;

SqlConnection dbConn = SupportClasses.SqlUtilities.DBConn();
SqlCommand cmd;
SqlTransaction storeSession = null;
SqlParameter uidParam, keyParam, objParam;
try
{
dbConn.Open();
storeSession = dbConn.BeginTransaction();
foreach (string key in _session.Keys)
{
toSerialize = _session[ key ];
stream = new MemoryStream();
formatter.Serialize(stream, toSerialize);

cmd = new SqlCommand("store_session_object", dbConn, storeSession);
cmd.CommandType = CommandType.StoredProcedure;
uidParam = new SqlParameter("@uid", SqlDbType.VarChar);
uidParam.Value = uid;
cmd.Parameters.Add(uidParam);
keyParam = new SqlParameter("@object_key", SqlDbType.VarChar);
keyParam.Value = key;
cmd.Parameters.Add(keyParam);
objParam = new SqlParameter("@data", SqlDbType.Image);
objParam.Value = stream.ToArray();
cmd.Parameters.Add(objParam);

cmd.ExecuteNonQuery();
}
}
catch (SqlException ex)
{
SupportClasses.ErrorHandler.HandleSQLError(ex);
storeSession.Rollback();
}
catch (System.Runtime.Serialization.SerializationException exs)
{
// do something
}
finally
{
dbConn.Close();
}


For those interested, here is the code for the SP:

CREATE PROCEDURE store_session_object
@uid varchar(50),
@object_key varchar(25),
@data image
AS
INSERT INTO session_hold (uid, object_key, object)
VALUES (@uid, @object_key, @data)


[Cross-posted because issue spans several topics.]

View 2 Replies View Related

Storing Xml In Sql Server 2000

Sep 21, 2005

Hi,
I am aggregating some in-coming XML SOAP envelopes and I need to persist them to the database.

Is there a recommended data type to handle this? Should I be using ntext, text or other data type?

I know in Sql Server 2005 there will be a specific Xml Data Type; but, that is not an option until Nov 7, 2005.

View 3 Replies View Related

Storing Server Information

Apr 9, 2001

Hello,
We are just setting up SQL Server 2000 and wanted to keep track of all our server settings(everything needed for worst case scenario). Does anybody have a standard template that we could follow to record all our info?

Thanks!

View 2 Replies View Related

Storing Images In Sql Server

Aug 11, 2004

I wanted to store image files in my Db.So can i use image data type?If i can use the image data type how big images can i store.My image are arounf 10 mb in size.
Thanks.

View 2 Replies View Related

Storing Packages In Sql Server?

Dec 20, 2006

I understand that packages can be stored in the MSDB database. However, is it possible to store packages in another database and have them managed by the SSIS service?

View 7 Replies View Related

Storing Objects In SQL Server 2005

Oct 24, 2006

Hi All,I am looking to store a DataSet into a Table in SQL Server 2005, or any object for that matter.   I cannot find any code to perform.  Can anyone help?Many Thanks,Peppa.   

View 2 Replies View Related

Problem Storing Images In SQL Server

Jan 17, 2007

So what's the secret to getting images in and out of a SQL database?  There's lots out there about this, but I cant seem to get any of it to work...
I have a table, named Attachments and among other columns I have one called Attachment.  I've tried using both image and varbinary(max) data types, both with the same results.
I have an sproc with the following code:
INSERT INTO Attachments (Attachment) SELECT * FROM OPENROWSET(BULK 'c: est.bmp', SINGLE_BLOB) AS BulkColumn
That seems to read the file and create a record.  If I move the file, yeah it complains it doesnt exist...  If I "show data" on the table, there is a new record and under Attachment, it says "<Binary Data>.  t seems to be there, but who knows for sure...
So in an aspx file, I have the following:
myConnection.Open();string SQL = "SELECT Attachment FROM Attachments";SqlCommand myCommand = new SqlCommand(SQL, myConnection);byte[] bytePic = (byte[])myCommand.ExecuteScalar();
When I run it, it errors out on that last line with "Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.
With the use of "DBNull", it sure does seem the SQL is coming up emtpy handed, eh?  If I change the SELECT to AttachmentId (an identity field), it says it cant cast a "system32" - which makes sense...  Any ideas whats going on?  Many thanks!!   -- Curt
 
 

View 2 Replies View Related

Image Storing In SQL Server 2000

Apr 15, 2007

HI,
Kindly Guide me how to store picture files in SQL server 2000 using Visual studio 2005
 
 

View 3 Replies View Related

About Storing And Receiving A Location From SQL SERVER.....................

Jul 12, 2007

 hi friends,             i want to store an image in DB. but most of my friends told that, to store an image in web server then store tat location in a DB and access it anywhere. this is for asp.net in C#-code behind. how to do this? i've a table with a text field. then .......? waiting for ur reply............ note: i need coding. not by using controls. pls...

View 1 Replies View Related

Storing ASP.NET 2.0 Profiles In SQL Server 2005

Oct 17, 2007

Hi Everyone,
I have an e-commerce site that uses Profiles in ASP.NET 2.0 to store items in a shopping cart.  The problem is that we are now using LDAP authentication, so we are getting rid of the ASPNETDB membership database that stores the profile values.  How can get the shopping cart functionalty to work with SQL Server 2005?  How can I store the profile object in a SQL Server instead of the ASP.NET memberships database?
Here is the profile field:
  <profile enabled="true">      <properties>        <add name="Cart" serializeAs="Binary" type="Commerce.ShoppingCart" allowAnonymous="true"/>      </properties>    </profile>
 
Thank you in Advance
-Sam 
 

View 1 Replies View Related

Storing PDF Files In SQL Server And Retrieving Them Using ASP.net

Feb 18, 2003

Can you guys give me any specific classes I should read about to implement the above? Any specific methods?

Any webpage I should read?

Thanks for your direction/help!

View 22 Replies View Related

Storing A XML File In A SQL Server Database

Jun 23, 2004

I have records with 50 plus fields of data.I was thinking of writing all the fields data into a XML file and then store it in a SQL server database for retrieval later on.Is there anyway i can go about doing this?

View 6 Replies View Related

Help Regarding Storing And Retrieval Of Files In Sql Server

Oct 29, 2004

Hi,
Thanks in advance.

I need help(Tutorials or online links) regarding storing and retrieval of files in Sql server (BLOB) using ASP.net and C#.
Secondly,Is it possible to search file in BLOB using SQL server Full text search service.

View 1 Replies View Related

Storing Byte Array In Sql Server

Jan 8, 2006

Hello, I am using .net 1.1 and sql server 2000.

I want to store a byte array, but it seems that only a string is stored there.

Code:

SHA512 sha = new SHA512Managed();

byte[] ReturnedPasswordByte = sha.ComputeHash(ToCryptByte);




MyGenericCommand.Parameters.Add("@Password", ReturnedPasswordByte);

MyConnection.Open();
MyGenericCommand.ExecuteNonQuery();
MyConnection.Close();


If I select the record later, all I get is "System.Byte[]" (as string)

View 1 Replies View Related

Storing Multiple Languages In Sql Server

Jul 14, 2004

Is it possible to store multiple languages in one sql server.Now i have a sqlserver with US English.Can i store spanish and french data in the DB?If possible how can i store it...?

Thanks.

View 1 Replies View Related

How Would I Go About Storing Pictures In A SQL Server Database?

Aug 18, 2004

I'm constructing an image gallery for my site and was wondering how to store the pictures in the database? Would the best way to do it, by storing the link instead of the image in the database?

How would I use the insert and select with it? :confused:

View 1 Replies View Related

Storing Word Docs In Sql Server

Apr 22, 2006

Hi Guys

i have a list of 10 word docs and i want to store them in sql server.
How can i do that??

Should i create any fmt files for that???

Thanks
Vic

View 3 Replies View Related

Storing An Image Into Sql Server Database

Jul 23, 2005

Is there any way of storing an image file into a specific Table .It would be of great help for me if i come to know something about it.

View 2 Replies View Related

Storing Time In SQL Server 2000

Jul 20, 2005

HI there,I currently store the date using the getdate() functionbut how can I store just the time or seperate the time off from adatetime datatype?M3ckon*** Sent via Devdex http://www.devdex.com ***Don't just participate in USENET...get rewarded for it!

View 4 Replies View Related

Storing Images In Sql Server 2005

Jun 5, 2006

Hi There

I have not had much luck finding info in BOL.

I have a directory with many images, i need to load these images into sql server.We want to staore them in the database instead of the file server.

What is the best way to do this? TSQL (i am hoping), .NET code or maybe even SSIS ?

I have been reading what i can find in BOL basically all i know so far is that image data type will be no more in the future and i should use a varbinary(max) data type.
Basically i need a good link or something that can demonstrate how one can go about loading images into Sql Server 2005.



Thanx

View 6 Replies View Related

Storing A PDF File Into SQL Server 2005?

Jan 16, 2008

Does anyone know whats wrong with my code?
~Nothing wrong with my code, code is correct!

I let it run and it keeps saying that the file does not exist. Seem as though, the path of my file doesn't exist! Any suggestions on how to program the path of my file so I can be able to retreive it such as open the file and access the file?

CODE:


Imports System

Imports System.Data

Imports System.Data.Sql

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Imports System.Web

Imports System.Configuration

Imports System.Reflection

Imports System.Security.Permissions.FileIOPermission

Imports System.IO

Imports System.Collections

Imports System.Collections.Generic

Imports System.Windows.Forms

Imports System.Security.Permissions

Imports System.Windows.Forms.Form

'<Assembly: PermissionSetAttribute(SecurityAction.RequestMinimum, Name:="Local Intranet")>

'<Assembly: PermissionSetAttribute(SecurityAction.RequestOptional, Unrestricted:=True)>



Public Class Form1

Inherits Form

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim SQL As String

Dim rawData() As Byte

Dim RowsAffected As Integer

Dim filename As String

filename = "H:My Documentsabc.pdf"

Try

If System.IO.File.Exists(filename) Then

Dim filePermission As New System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.Read, System.Security.AccessControl.AccessControlActions.View, filename)

filePermission.Demand()

Else

MessageBox.Show("file does not exist", "File", MessageBoxButtons.OK, MessageBoxIcon.Information)

End If

Dim fs As FileStream

fs = New FileStream(filename, FileMode.Open, FileAccess.Read)

Dim FileSize = Convert.ToInt32(fs.Length)

rawData = New Byte(FileSize) {}

fs.Read(rawData, 0, FileSize)

SQL = String.Format("INSERT INTO test_file_save(FILE_ID, FILE_NAME, FILE_SIZE, CREATE_FILE) VALUES({0}, {1}, {2}, {3})", _

1, filename, FileSize, rawData)

Using Conn As New SqlConnection("server=1234;" _

& "uid=F_User;" _

& "pwd=password;" _

& "database=Database")

Using Cmd As New SqlCommand("sp_InsertPDF", Conn)

Cmd.CommandType = CommandType.StoredProcedure

Cmd.Parameters.Add(New SqlParameter("@FILE_ID", 1))

Cmd.Parameters.Add(New SqlParameter("@FILE_NAME", filename))

Cmd.Parameters.Add(New SqlParameter("@FILE_SIZE", FileSize))

Cmd.Parameters.Add(New SqlParameter("@CREATE_FILE", rawData))

fs.Close()

Conn.Open()

RowsAffected = Cmd.ExecuteNonQuery()

End Using

End Using

MessageBox.Show("File Inserted into database successfully!", _

"Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)

Catch ex As Exception

MessageBox.Show("There was an error: " & ex.Message, "Error", _

MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try







End Sub

End Class

View 5 Replies View Related

Storing Serialized Data In Sql Server CE????????

Feb 19, 2008

Hi
is it possible to store a SQL CE command object in SQL Server CE database.
If so then what would be the datatype of such column????


thanx in advance

View 1 Replies View Related

Storing Files To Server, Directory Or Database, Which Is Better?

Feb 9, 2007

Which is better, to store the files onto the server's folders or to a database?
I tried storing to MSSQL 2000 but the varbinary does not allow me to set "MAX" for the data type.
 

View 1 Replies View Related

Storing Arabic Data In Db(sql Server 2005)

Oct 1, 2007

Hi,
How to insert or store arabic data into a table in sql server 2005, also i want to retrieve it as arabic format.But now it insert  (?????) like this.Please help me to find a solution. 
Regards
Sabna S

View 3 Replies View Related

Storing DATA To Sql Server From Access Efficiency

Jun 13, 2008

 I have a function which is writing thousands of records coming from Access database and I was wondering if someone can suggest how can reconstruct my code for faster processing. Here my code: Public Sub MigrateNFSData(ByVal calcTbl As DataTable, ByVal strDBConnection As String)        Dim sqlServerConn As New SqlConnection(strDBConnection)        'Define stored procedures        Dim command As New SqlCommand        Dim getAccID As New SqlCommand("GetAccountID", sqlServerConn)        Dim getActionID As New SqlCommand("GetActionID", sqlServerConn)        Dim getExchangeID As New SqlCommand("GetExchangeID", sqlServerConn)        'Dim getParrentAccID As New SqlCommand("GetParentAccID", sqlServerConn)        Dim getStatusID As New SqlCommand("GetStatusID", sqlServerConn)        Dim getTraderID As New SqlCommand("GetTraderID", sqlServerConn)        Dim getGroupID As New SqlCommand("GetGroupID", sqlServerConn)        Dim getGroupIDByIP As New SqlCommand("GetGroupIDByIP", sqlServerConn)        Dim getTraderIDByIP As New SqlCommand("GetTraderIDByIP", sqlServerConn)        'Define insert records stored procedures        Dim insertAcc As New SqlCommand("InsertAccount", sqlServerConn)        insertAcc.CommandType = CommandType.StoredProcedure        Dim insertAction As New SqlCommand("InsertAction", sqlServerConn)        insertAction.CommandType = CommandType.StoredProcedure        Dim insertExchange As New SqlCommand("InsertExchange", sqlServerConn)        insertExchange.CommandType = CommandType.StoredProcedure        Dim insertGroup As New SqlCommand("InsertGroup", sqlServerConn)        insertGroup.CommandType = CommandType.StoredProcedure        Dim insertStatus As New SqlCommand("InsertStatus", sqlServerConn)        insertStatus.CommandType = CommandType.StoredProcedure        Dim insertTrader As New SqlCommand("InsertTrader", sqlServerConn)        insertTrader.CommandType = CommandType.StoredProcedure        Try            sqlServerConn.Open()        Catch ex As Exception            MessageBox.Show("Connection failed to open!")        End Try        'Set parameters to helper Get Stored Procedures to retreive Id's         getAccID.Parameters.Add("@AccName", SqlDbType.NVarChar)        getAccID.CommandType = CommandType.StoredProcedure        getActionID.Parameters.Add("@ActionName", SqlDbType.NVarChar)        getActionID.CommandType = CommandType.StoredProcedure        getExchangeID.Parameters.Add("@ExchName", SqlDbType.NVarChar)        getExchangeID.CommandType = CommandType.StoredProcedure        'getParrentAccID.Parameters.Add("@ParentName", SqlDbType.NVarChar)        'getParrentAccID.CommandType = CommandType.StoredProcedure        getStatusID.Parameters.Add("@StatusName", SqlDbType.NVarChar)        getStatusID.CommandType = CommandType.StoredProcedure        getTraderID.Parameters.Add("@TraderName", SqlDbType.NVarChar)        getTraderID.CommandType = CommandType.StoredProcedure        getGroupID.Parameters.Add("@GroupName", SqlDbType.NVarChar)        getGroupID.CommandType = CommandType.StoredProcedure        getGroupIDByIP.Parameters.Add("@IP", SqlDbType.NVarChar)        getGroupIDByIP.CommandType = CommandType.StoredProcedure        getTraderIDByIP.Parameters.Add("@IP", SqlDbType.NVarChar)        getTraderIDByIP.CommandType = CommandType.StoredProcedure        command = New SqlCommand("InsertTradeTransaction", sqlServerConn)        command.CommandType = CommandType.StoredProcedure        'Set Parameters for Insert stored procedures        insertAcc.Parameters.Add("@Account", SqlDbType.Text)        insertAction.Parameters.Add("@ActionName", SqlDbType.Text)        insertExchange.Parameters.Add("@Exchange", SqlDbType.Text)        insertGroup.Parameters.Add("@Group", SqlDbType.Text)        insertGroup.Parameters.Add("@ACCID", SqlDbType.Int)        insertGroup.Parameters.Add("@GroupID", SqlDbType.UniqueIdentifier)        insertStatus.Parameters.Add("@StatusName", SqlDbType.Text)        insertTrader.Parameters.Add("@Group", SqlDbType.UniqueIdentifier)        insertTrader.Parameters.Add("@IP", SqlDbType.Text)        insertTrader.Parameters.Add("@TraderName", SqlDbType.Text)        insertTrader.Parameters.Add("@TraderID", SqlDbType.UniqueIdentifier)        'Adding stored Get Stored Procedure's parameters-----------------------        command.Parameters.Add("@OrderNum", SqlDbType.Text)        command.Parameters.Add("@ACC_ID", SqlDbType.Int)        command.Parameters.Add("@Group_ID", SqlDbType.UniqueIdentifier)        command.Parameters.Add("@Trader_ID", SqlDbType.UniqueIdentifier)        command.Parameters.Add("@Exch_ID", SqlDbType.Int)        command.Parameters.Add("@Date", SqlDbType.DateTime)        command.Parameters.Add("@Time", SqlDbType.DateTime)        command.Parameters.Add("@ActionID", SqlDbType.Int)        command.Parameters.Add("@StatusID", SqlDbType.Int)        command.Parameters.Add("@TimeSent", SqlDbType.DateTime)        command.Parameters.Add("@Qty", SqlDbType.Int)        command.Parameters.Add("@Product", SqlDbType.Text)        command.Parameters.Add("@MMYYY", SqlDbType.Text)        command.Parameters.Add("@ExchOrderID", SqlDbType.Text)        command.Parameters.Add("@TimeTicks", SqlDbType.Int)        command.Parameters.Add("@W2G", SqlDbType.Int)        command.Parameters.Add("@W2Exch", SqlDbType.Int)        command.Parameters.Add("@G2ExchDerived", SqlDbType.Int)        command.Parameters.Add("@Msg", SqlDbType.NVarChar)        'command.Parameters.Add("@ExchDate", SqlDbType.DateTime)        'command.Parameters.Add("@ParentID", SqlDbType.Int)        'Paremeters Defenition--------------------------------------        'Parsing DateTime Objects        Dim formaterA As IFormatProvider        formaterA = New System.Globalization.CultureInfo("en-GB", True)        Dim dateObj As Date        'DEBUG        'Dim rows = calcTbl.Rows.Count        Dim colValues = GetColumnsValues(calcTbl)        'Write table with computed NFS data to sql server DB        For Each dr As DataRow In calcTbl.Rows            Dim orderNo = dr.Item("Order No").ToString()            command.Parameters("@OrderNum").Value = dr.Item("Order No").ToString()            getAccID.Parameters("@AccName").Value = dr.Item("Acct").ToString()            If getAccID.ExecuteScalar() = Nothing Then                insertAcc.Parameters("@Account").Value = dr.Item("Acct").ToString()                insertAcc.ExecuteNonQuery()                getAccID.Parameters("@AccName").Value = dr.Item("Acct").ToString()                command.Parameters("@ACC_ID").Value = getAccID.ExecuteScalar()            Else                command.Parameters("@ACC_ID").Value = Int32.Parse(getAccID.ExecuteScalar()).ToString()            End If            getGroupID.Parameters("@GroupName").Value = dr.Item("Group ID").ToString()            If getGroupID.ExecuteScalar() = Nothing Then                'Find Group by IP address if input Data Table doesn't have group                getGroupIDByIP.Parameters("@IP").Value = dr.Item("IP").ToString()                If getGroupIDByIP.ExecuteScalar() = Nothing Then                    insertGroup.Parameters("@GroupID").Value = Guid.NewGuid                    insertGroup.Parameters("@Group").Value = dr.Item("Group ID")                    insertGroup.Parameters("@ACCID").Value = getAccID.ExecuteScalar()                    insertGroup.ExecuteNonQuery()                    command.Parameters("@Group_ID").Value = getGroupID.ExecuteScalar()                Else                    command.Parameters("@Group_ID").Value = getGroupIDByIP.ExecuteScalar()                End If            Else                command.Parameters("@Group_ID").Value = getGroupID.ExecuteScalar()            End If            getTraderID.Parameters("@TraderName").Value = dr.Item("Trd ID").ToString()            If getTraderID.ExecuteScalar() = Nothing Then                getTraderIDByIP.Parameters("@IP").Value = dr.Item("IP").ToString()                If getTraderIDByIP.ExecuteScalar() = Nothing Then                    insertTrader.Parameters("@Group").Value = getGroupID.ExecuteScalar()                    insertTrader.Parameters("@IP").Value = dr.Item("IP").ToString()                    insertTrader.Parameters("@TraderName").Value = dr.Item("Trd ID").ToString()                    insertTrader.Parameters("@TraderID").Value = Guid.NewGuid                    insertTrader.ExecuteNonQuery()                    command.Parameters("@Trader_ID").Value = getTraderID.ExecuteScalar()                Else                    command.Parameters("@Trader_ID").Value = getTraderIDByIP.ExecuteScalar()                End If            Else                command.Parameters("@Trader_ID").Value = getTraderID.ExecuteScalar()            End If            getExchangeID.Parameters("@ExchName").Value = dr.Item("Exch").ToString()            If getExchangeID.ExecuteScalar() = Nothing Then                insertExchange.Parameters("@Exchange").Value = dr.Item("Exch").ToString()                insertExchange.ExecuteNonQuery()                command.Parameters("@Exch_ID").Value = getExchangeID.ExecuteScalar()            Else                command.Parameters("@Exch_ID").Value = getExchangeID.ExecuteScalar()            End If            getActionID.Parameters("@ActionName").Value = dr.Item("Action").ToString()            If getActionID.ExecuteScalar() = Nothing Then                insertAction.Parameters("@ActionName").Value = dr.Item("Action").ToString()                command.Parameters("@ActionID").Value = getActionID.ExecuteScalar()            Else                command.Parameters("@ActionID").Value = getActionID.ExecuteScalar()            End If            getStatusID.Parameters("@StatusName").Value = dr.Item("Status").ToString()            If getStatusID.ExecuteScalar() = Nothing Then                insertStatus.Parameters("@StatusName").Value = dr.Item("Status").ToString()                insertStatus.ExecuteNonQuery()                command.Parameters("@StatusID").Value = getStatusID.ExecuteScalar()            Else                command.Parameters("@StatusID").Value = getStatusID.ExecuteScalar()            End If            'getParrentAccID.Parameters("@ParentName").Value = ""            'If getParrentAccID.ExecuteScalar() = 0 Then            'insert parent acc            'Else            'command.Parameters("@ParentID").Value = getParrentAccID.ExecuteScalar()            dateObj = Date.Parse(dr.Item("Exch Date").ToString(), formaterA)            command.Parameters("@Date").Value = dateObj            command.Parameters("@Time").Value = DateTime.Parse(dr.Item("Time").ToString())            command.Parameters("@TimeSent").Value = DateTime.Parse(dr.Item("Time Sent").ToString())            If (dr.Item("Qty").Equals(System.DBNull.Value)) Then                command.Parameters("@Qty").Value = System.DBNull.Value            Else                command.Parameters("@Qty").Value = Int32.Parse(dr.Item("Qty").ToString())            End If            command.Parameters("@Product").Value = dr.Item("Product").ToString()            command.Parameters("@MMYYY").Value = dr.Item("MMMYY").ToString()            command.Parameters("@ExchOrderID").Value = dr.Item("Exchange Order ID").ToString()            If (dr.Item("Time Ticks").Equals(System.DBNull.Value)) Then                command.Parameters("@TimeTicks").Value = System.DBNull.Value            Else                command.Parameters("@TimeTicks").Value = Int32.Parse(dr.Item("Time Ticks").ToString())            End If            'command.Parameters("@ExchDate").Value = Date.Parse(dr.Item("Exch Date").ToString())            'command.Parameters("@ExchDate").Value = Convert.ToDateTime(dr.Item("Exch Date").ToString())            'DEBUG            'Dim strW2G = dr.Item("W2G").ToString()            'Dim strW2E = dr.Item("W2E").ToString()            If (dr.Item("W2G").Equals(System.DBNull.Value)) Then                command.Parameters("@W2G").Value = System.DBNull.Value            Else                command.Parameters("@W2G").Value = Int32.Parse(dr.Item("W2G").ToString())            End If            If dr.Item("W2E").Equals(System.DBNull.Value) Then                command.Parameters("@W2Exch").Value = System.DBNull.Value            Else                command.Parameters("@W2Exch").Value = Int32.Parse(dr.Item("W2E").ToString())            End If            'command.Parameters("@G2ExchDerived").Value = Int32.Parse(dr.Item("Time Delta G2E").ToString())            If (dr.Item("Time Delta G2E").Equals(System.DBNull.Value)) Then                command.Parameters("@G2ExchDerived").Value = System.DBNull.Value            Else                command.Parameters("@G2ExchDerived").Value = Int32.Parse(dr.Item("Time Delta G2E").ToString())            End If            command.Parameters("@Msg").Value = dr.Item("Msg").ToString()            command.ExecuteNonQuery()        Next        sqlServerConn.Close()    End Sub

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved