Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server






SuperbHosting.net & Arvixe.com have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for BigResource.com.







Create Tables And Insert Data In Sql Server Mobile On Dekstop


Hello (sorry my bad english, im brazilian)

I was using Visual Studio 2003 and SQL Server CE 2.0 for C# mobile applications. The .sdf database were created in the emulator or in the mobile device itself using Query Analizer.

The application developed need some initial data to run, and this data is obtained executing one service that reads a postgree database, and insert the data in the SQL CE database of the mobile device. But, given the size of the database (maybe 10.000 rows), it tooks too much time (sometimes 6 hours).

Now we are migrating to Visual Studio 2005 and SQL Server 2005 Mobile Edition.

I want to know if its possible to create the .sdf database and load the data into this database on the desktop. Maybe through the execution of a .sql script, or through a service executed on the desktop.

After this, its just upload de .sdf file to the mobile device.

Thanks

Robson


View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Import Csv Data To Dbo.Tables Via CREATE TABLE && BUKL INSERT:How To Designate The Primary-Foreign Keys && Set Up Relationship?
Hi all,
 
I use the following 3 sets of sql code in SQL Server Management Studio Express (SSMSE) to import the csv data/files to 3 dbo.Tables via CREATE TABLE & BUKL INSERT operations:
 
-- ImportCSVprojects.sql --

USE ChemDatabase

GO

CREATE TABLE Projects

(

ProjectID int,

ProjectName nvarchar(25),

LabName nvarchar(25)

);

BULK INSERT dbo.Projects

FROM 'c:myfileProjects.csv'

WITH

(

FIELDTERMINATOR = ',',

ROWTERMINATOR = ''

)

GO
=======================================
-- ImportCSVsamples.sql --

USE ChemDatabase

GO

CREATE TABLE Samples

(

SampleID int,

SampleName nvarchar(25),

Matrix nvarchar(25),

SampleType nvarchar(25),

ChemGroup nvarchar(25),

ProjectID int

);

BULK INSERT dbo.Samples

FROM 'c:myfileSamples.csv'

WITH

(

FIELDTERMINATOR = ',',

ROWTERMINATOR = ''

)

GO
=========================================
-- ImportCSVtestResult.sql --

USE ChemDatabase

GO

CREATE TABLE TestResults

(

AnalyteID int,

AnalyteName nvarchar(25),

Result decimal(9,3),

UnitForConc nvarchar(25),

SampleID int

);

BULK INSERT dbo.TestResults

FROM 'c:myfileLabTests.csv'

WITH

(

FIELDTERMINATOR = ',',

ROWTERMINATOR = ''

)

GO

========================================
The 3 csv files were successfully imported into the ChemDatabase of my SSMSE. 
 
2 questions to ask:
(1)  How can I designate the Primary and Foreign Keys to these 3 dbo Tables?
      Should I do this "designate" thing after the 3 dbo Tables are done or during the "Importing" period?
(2) How can I set up the relationships among these 3 dbo Tables?
 
Please help and advise.
 
Thanks in advance,
Scott Chang
 
  

View Replies !   View Related
Can't Insert Binary Data Into Sql Mobile
Hi guys, I'm having a problem inserting a file into a SQL Mobile table.

I'm updating the table via a tableadapter designed through the Dataset designer in VS2k5.

The SQL used to insert is "Insert into TestTable (itemid,itemdata) values (@itemid,@itemdata)"

Where ItemID is a GUID, and ItemData is an Image field. The tableadapter has typed the parameters as GUID and Binary properly already.

Only problem is when I actually call the command with a byte array containing my file, I get a "Byte truncation" error message.

I remember this working properly in SQL CE 2.0 but so far I don't seem to get it to work in SQL mobile, anyone got any pointers?

View Replies !   View Related
Grabbing Mobile Data For Desktop Ui (update/delete/insert)
Howdy,

Am trying to find a way to insert/update/delete data in a SQL mobile database on a Windows CE 5.0 device FROM a desktop PC.

This situation is completely stand alone, no network (apart form device/desktop), no GPRS etc etc etc.

I've looked at RDA but i dont believe it fits my app. (pulling data from a 2005 server that doesnt exist doesnt really help me much, push can't be used without a pull which kills the idea.)

The goal is a UI on the desktop that can manipulate data in the SQL mobile Database.

I've tried all i can find/think off in relation to this but to no avail.

My latest attempt has been using the simplest method possible (using a VS wizard datasource to the devices DB and tryign to whack that on a form)  but this just creates a "Path not found. Check the directory for the database [Path = Mobile Device/ce_swipe/TestDB.sdf".

View Replies !   View Related
Use SQL Server Mobile On Your Desktop (create/use Sql Server Mobile Databases On Your Desktop)
After a little bit of
search, I succeeded! Here are the guidelines for using an SQL server
mobile dataset residing in your desktop computer on your desktop
(populating a SQL Server mobile database on your desktop). At the end
of the guidelines, I give a sample program to populate an sqlce
database from a text file.

I hope you will find these guidelines and sample program usefull.

You may contact me at toncu@nospam.e-kolay.net (remove nospam for actual address)

(You should have VS2005 and Sql Server 2005 installed on your desktop computer)

1. create a Windowsapplication project
    File->New Project
    Choose Windows in Project Types and Windows Apllication from Templates

2. Insert a reference to SQL Server Mobile
    Project->Add Reference->Browse
    c:Program FilesMicrosoft Visual Studio 8
       Common7IDESystem.Data.SqlServerCE.DLL

3. Insert
    imports system.data.sqlserverce
at the top of your form file

4. Write your application just as you would  as if your project was a Smartdeviceapplication.

i.e. use sqlconnection and other constructs.


A sample application is as follows:
(dbtableexist is a subroutine which shows how to process the SCHEMA.
In this subroutine, change TABLES to INDEXES and TABLE_NAME to INDEX_NAME to search for an index)

Imports system.data.SqlServerCe
Imports System.IO
    Public Sub createaccessfile(ByVal a$)
        'curdbpath is the path of the database e.g. d:my sql databases
        Dim connStr As String = "Data Source = " & curdbpath & a$ & ".sdf"
        Dim conn As SqlCeConnection = Nothing
        Dim command As SqlCeCommand
        Try
            conn = New SqlCeConnection(connStr)
            conn.Open()
            command = conn.CreateCommand()
            If dbtableexist(conn, "ACCESSFILE") Then
                command.CommandText = "DROP TABLE ACCESSFILE"
                command.ExecuteNonQuery()
            End If
           
command.CommandText = "CREATE TABLE ACCESSFILE ( code nchar(20),field
nchar(3),totalrecs  nvarchar(255),indexbits ntext)"
            command.ExecuteNonQuery()
            command.CommandText = "CREATE INDEX codeindex on ACCESSFILE (field,code)"
            command.ExecuteNonQuery()
        Catch ex As SqlCeException
            Dim m1 = ex.Message
            Dim m2 = ex.Source
            Dim m3 = ex.NativeError
            MsgBox(m1 & m2 & m3, , "open " & a$ & " for accessfile creation")
            Exit Sub
        End Try

        ' Create and prepare a SQL statement.
        command.CommandText = " insert into accessfile values (?,?,?,?);"

        ' Read and insert the lines from the file until the end
        ' of the file is reached.
        Dim accfname As String = curdbpath & a$ & "_accessfile.inp"
        Dim fs As FileStream = New FileStream(accfname, FileMode.Open)
        Dim sr As New StreamReader(fs)
        Dim line As String, codestr As String, fieldstr As String, totalrecsstr As String, indexbitsstr As String
        Dim line1 As String, flagstr As String, field As Integer

        line = sr.ReadLine : line1 = line
        Dim currec As Integer = 0
        ' Note: Even though named parameterized queries are not supported, we still need
        '       to provide unique parameter names so that we can manipulate parameter collection;
        command.Parameters.Add("@code", "a")
        command.Parameters.Add("@field", 1)
        command.Parameters.Add("@totrecs", "c")
        command.Parameters.Add("@indexbits", "d")
        Do
            currec = currec + 1
            If currec Mod 10 = 0 Then dispcaption(Str(currec))
            flagstr = before(line, Chr(9)) : line = after(line, Chr(9))
            codestr = before(line, Chr(9)) : line = after(line, Chr(9))
            field = Val(before(line, Chr(9))) : line = after(line, Chr(9))
            totalrecsstr = before(line, Chr(9)) : line = after(line, Chr(9))
            indexbitsstr = line
            Try
                command.Parameters(0).Value = codestr
                command.Parameters(1).Value = Format(field, "000")
                command.Parameters(2).Value = totalrecsstr
                command.Parameters(3).Value = indexbitsstr
                ' Calling Prepare after having set the Commandtext and parameters.
                command.Prepare()
                command.ExecuteNonQuery()
            Catch ex As SqlCeException
                Dim m1 = ex.Message
                Dim m2 = ex.Source
                Dim m3 = ex.NativeError
                MsgBox(m1 & m2 & m3, , "Add record to Acessfile")
                conn.Close()
                sr.Close()
                Exit Sub
            End Try
            line = sr.ReadLine : line1 = line
        Loop Until line Is Nothing
        sr.Close()
        conn.Close()
    End Sub
    Private Function dbtableexist(ByVal dbconnection As SqlCeConnection, ByVal tablename As String) As Boolean
        Dim cmd As SqlCeCommand, rdr As SqlCeDataReader
        Dim iname As String, tablename1 As String, i As Integer
        tablename1 = UCase(tablename)
        cmd = dbconnection.CreateCommand
        cmd.CommandType = CommandType.Text
        cmd.CommandText = "select * from INFORMATION_SCHEMA.INDEXES"
        Try
            rdr = cmd.ExecuteReader
        Catch ex As SqlCeException
            Dim m1 = ex.Message
            Dim m2 = ex.Source
            Dim m3 = ex.NativeError
            MsgBox(m1 & m2 & m3)
            Stop
        End Try
        Do While rdr.Read
            iname = rdr("TABLE_NAME")
            If UCase(iname) = tablename1 Then dbtableexist = True : Exit Function
        Loop
        dbtableexist = False
    End Function

View Replies !   View Related
Unable To Create SQL Server Mobile Subscription
I have been following Creating a Mobile Application with SQL Server Mobile:

http://msdn2.microsoft.com/en-us/library/ms171908.aspx

I have successfully created the snapshot. 

When performing the following:

Configure the publication for Web synchronization






In SQL Server Management Studio, in Object Explorer, expand the (local) computer node.


Right-click the Replication folder, and then choose Configure Web Synchronization

    There is no option when Right-clicking the Replication folder under my local server, however there IS an option for Configuring Web Synchronization on the Replication folder under SQL Server Mobile.  (Unfortunately the Configure the publication for Web Synchronization is listed BEFORE the SQLServer Mobile Task, so it is pretty confusing)  So, assuming this is what the author meant, I successfully configured the Web Server and the SQLMobile shows under my default web site.

 

When I attempt to create a Subscription under SQLServer Mobile, I get the following error:

 

- Synchronizing Data (Error)



Messages

Unexpected HTTP status returned. [ 415,status = ]
HRESULT 0x80004005 (28632)


The operation could not be completed.


Am I missing something?  Should the web configuration be done on my local SQL Server, not the SQLServer Mobile replication directory?  If so, how come I do not have that option as suggested in the directions?

I have checked and rechecked permissions.  As I mentioned, the snapshot is successfully created (verified by Right-clicking the publication and viewing the snapshot agent status)

 

 

View Replies !   View Related
How Do I Export Data From MS SQL Server Tables To Text File With 'insert' Statements
I am trying to take an entire MS SQL database and put it in an sql file. I have succesfully copied the tables into an sql file by highlighting the tables in enterprise manager and choosing 'generate sql script'.

That gives me the structure, but now I would like the data (in insert statements). I have looked in enterprise manager's export wizard and sql analyzer to no avail. There seem to be a lot of options for exporting data except this one! Please point me in the right direction.

At the end of the day, I would like to be able to put everything in a text file. Then, should I have problems, I can just copy my text into query analyzer and have a brand new database.

Thank you in advance.

View Replies !   View Related
SQL Server Tables Into SQL Mobile
Hi all,

My apologies in advance for maybe appearing a little novice-like in my questions. That's because I am.

I have a large table containing some 8500 records, migrated from Access to MS SQL. I can access it through VS.NET without any trouble. I've partially built an app for my WM5 device using VS.NET, with nice forms, etc., and want to be able to view the records present in the large table via the forms.

So I need to know the easiest way to acces the data via my WM5 device, using forms designed in VS.NET. I have SQL Server and SQL Server Mobile - can I move the data from the SQL Server tables into a new SQL Server Mobile database?

Any help you can give would be greatly appreciated.

John

View Replies !   View Related
DateTime.Min Won't Insert Into SQL Server Mobile 3.0
Hi all,

In my C# code I have a Class property that takes the value DateTime.Min upon initialisation, but when I try to insert this into the database column (yes, it is DateTime data type :)) I get an 'Unexpected Error' from SQL Server Mobile.

Is this a known?

Tryst

View Replies !   View Related
Cannot INSERT Data To 3 Tables Linked With Relationship (INSERT Statement Conflicted With The FOREIGN KEY Constraint Error)
Hello
 I have a problem with setting relations properly when inserting data using adonet. Already have searched for a solutions, still not finding a mistake...
Here's the sql management studio diagram :

 and here goes the  code1 DataSet ds = new DataSet();
2
3 SqlDataAdapter myCommand1 = new SqlDataAdapter("select * from SurveyTemplate", myConnection);
4 SqlCommandBuilder cb = new SqlCommandBuilder(myCommand1);
5 myCommand1.FillSchema(ds, SchemaType.Source);
6 DataTable pTable = ds.Tables["Table"];
7 pTable.TableName = "SurveyTemplate";
8 myCommand1.InsertCommand = cb.GetInsertCommand();
9 myCommand1.InsertCommand.Connection = myConnection;
10
11 SqlDataAdapter myCommand2 = new SqlDataAdapter("select * from Question", myConnection);
12 cb = new SqlCommandBuilder(myCommand2);
13 myCommand2.FillSchema(ds, SchemaType.Source);
14 pTable = ds.Tables["Table"];
15 pTable.TableName = "Question";
16 myCommand2.InsertCommand = cb.GetInsertCommand();
17 myCommand2.InsertCommand.Connection = myConnection;
18
19 SqlDataAdapter myCommand3 = new SqlDataAdapter("select * from Possible_Answer", myConnection);
20 cb = new SqlCommandBuilder(myCommand3);
21 myCommand3.FillSchema(ds, SchemaType.Source);
22 pTable = ds.Tables["Table"];
23 pTable.TableName = "Possible_Answer";
24 myCommand3.InsertCommand = cb.GetInsertCommand();
25 myCommand3.InsertCommand.Connection = myConnection;
26
27 ds.Relations.Add(new DataRelation("FK_Question_SurveyTemplate", ds.Tables["SurveyTemplate"].Columns["id"], ds.Tables["Question"].Columns["surveyTemplateID"]));
28 ds.Relations.Add(new DataRelation("FK_Possible_Answer_Question", ds.Tables["Question"].Columns["id"], ds.Tables["Possible_Answer"].Columns["questionID"]));
29
30 DataRow dr = ds.Tables["SurveyTemplate"].NewRow();
31 dr["name"] = o[0];
32 dr["description"] = o[1];
33 dr["active"] = 1;
34 ds.Tables["SurveyTemplate"].Rows.Add(dr);
35
36 DataRow dr1 = ds.Tables["Question"].NewRow();
37 dr1["questionIndex"] = 1;
38 dr1["questionContent"] = "q1";
39 dr1.SetParentRow(dr);
40 ds.Tables["Question"].Rows.Add(dr1);
41
42 DataRow dr2 = ds.Tables["Possible_Answer"].NewRow();
43 dr2["answerIndex"] = 1;
44 dr2["answerContent"] = "a11";
45 dr2.SetParentRow(dr1);
46 ds.Tables["Possible_Answer"].Rows.Add(dr2);
47
48 dr1 = ds.Tables["Question"].NewRow();
49 dr1["questionIndex"] = 2;
50 dr1["questionContent"] = "q2";
51 dr1.SetParentRow(dr);
52 ds.Tables["Question"].Rows.Add(dr1);
53
54 dr2 = ds.Tables["Possible_Answer"].NewRow();
55 dr2["answerIndex"] = 1;
56 dr2["answerContent"] = "a21";
57 dr2.SetParentRow(dr1);
58 ds.Tables["Possible_Answer"].Rows.Add(dr2);
59
60 dr2 = ds.Tables["Possible_Answer"].NewRow();
61 dr2["answerIndex"] = 2;
62 dr2["answerContent"] = "a22";
63 dr2.SetParentRow(dr1);
64 ds.Tables["Possible_Answer"].Rows.Add(dr2);
65
66 myCommand1.Update(ds,"SurveyTemplate");
67 myCommand2.Update(ds, "Question");
68 myCommand3.Update(ds, "Possible_Answer");
69 ds.AcceptChanges();
70

and that causes (at line 67):"The INSERT statement conflicted with the FOREIGN KEY constraint
"FK_Question_SurveyTemplate". The conflict occurred in database
"ankietyzacja", table "dbo.SurveyTemplate", column
'id'.
The statement has been terminated.
at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at AnkietyzacjaWebService.Service1.createSurveyTemplate(Object[] o) in J:\PL\PAI\AnkietyzacjaWebService\AnkietyzacjaWebServicece\Service1.asmx.cs:line 397"


Could You please tell me what am I missing here ?
Thanks a lot.
 

View Replies !   View Related
Can Not Create SQL Mobile Database On Server: The Operating System Does Not Support Encryption
I have code that creates a SQL Mobile database on a server.  It has worked in many environments, but I have one customer experiencing an issue.  It will not create the database on their server.  I would appreciate any thoughts.
 
The exact error message I get is "the operating system does not support encryption"
 
I am getting it on the line: SQLCeEngine.CreateDatabase()
 
Here is the code:
            SQLCeEngine = New SqlServerCe.SqlCeEngine(SQLConnectionString)
            ReturnValue += ": Declare new"
            SQLCeEngine.CreateDatabase()
            ReturnValue += ":Create"
            SQLCeEngine.Dispose()
            ReturnValue += ": Dispose"
 
Here is the error message I get from our application- the part after Err: is the actual error message from the system:
Data Source = D:EVADATAWebServiceDownloads est;Password=test;Persist Security Info=False;: Declare new:Error!:Err:The operating system does not support encryption.
 
When I go into SQL Express and create a SQL Mobile database using it, it can be created.  So, I have to believe it can be done on the server, but I don't know why the code can not do it.
(e.g. FileConnect Object ExplorerServer Type: SQL Server compact Edition and create a database).  The database is successfully created if I do it manually this way.  It even creates fine if I select the 'Encrypt' button.
 
The machine is a Windows 2000 Server sp4 version 5.00.2195
SQL 2000 is installed
SQL 2005 Express is installed
I ran the SQLServerCE31-EN.msi file and it is installed.  (I have also re-run and repaired it)
I have also copied over the newest version of our code from scratch.
 
SQL Server mgmt Studio: 9.00.3042.00
MDAC  2000.085.1128.00
MSXML 2.3 3.1 4.0 5.0 6.0
IE 6.0.2800.1106
.NET Framework 2.0.50727.42
Operating System 5.0.2195
 

View Replies !   View Related
Failure To Create First Replicated Database (SQL Mobile/SQL Server 2005) / Err 28627
Hi,

I'm trying to get my first replication going, and I have set up a database successfully, along with merge replication, however when I attempt to create the first subscriber, I get a permissions issue, regardless of what I do. In the SQLCESA30.LOG file, I get the following entries:

2006/01/07 16:59:36 Hr=00000000 SQLCESA30.DLL loaded 0
2006/01/07 16:59:58 Hr=80004005 ERR:OpenDB failed getting pub version 28627


I posted the initial thread under the "Replication" forum, but am including this 'pointer' post here due to a lack of replies there, and the relevance of this thread to this forum. Please see http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=193693&SiteID=1 for more details.

 

Thanks.

View Replies !   View Related
Use Data Dictionary To Create Tables
I have a data dictionay table with these columns
 












field_name
field_type
 field_size
 nulls
 #1
 #2
 #3

column1
char
20
 y
1
0
1

column2
char
30
 y
1
1
1

column3
int
5
 n
0
1
1

 
How to create a table using the content of the dd table above as the structure of my new table?
cb

View Replies !   View Related
Insert Records From Foxpro Tables To SQL Server Tables
Hi,

Currently, I'm using the following steps to migrate millions of records from Foxpro tables to SQL Server tables:

1. Transfer Foxpro records to .dat files and then bcp to SQL Server tables in a dummy database. All the SQL tables have the same columns as the Foxpro tables.
2. Manipulate the data in the SQL tables of the dummy database and save the manipulated data into the SQL tables of the real database where the tables may have different structure from the corresponding Foxpro tables.

I only know the following ways to import Foxpro data into SQL Server:

#1. Transfer Foxpro records to .dat files and then bcp to SQL Server tables
#2. Transfer Foxpro records to .dat files and then Bulk Insert to SQL Server tables
#3. DTS Foxpro records directly to SQL Server tables

I'm thinking whether the following choices will be better than the current way:

1st choice: Change step 1 to use #2 instead of #1
2nd choice: Change step 1 to use #3 instead of #1
3rd choice: Use #3 plus manipulating in DTS to replace step 1 and step 2

Thank you for any suggestion.

View Replies !   View Related
Insert Data Into Tables
Need some help. In my db I created 3 tables. 1- tblClient 2- tblCategories 3- tblClient_Cat ( colums: 1) client_id 2) cat_id).What I'm trying to do is create a sp to insert data from a web form into the tblClient and into the tblCat using the same sp. this is all I got so far.CREATE PROCEDURE [usp_insetClient](@ClientName varchar(25),@Contact varchar(100),@Tel char(13),@Fax char(13),@WebAdd varchar (250),@email varchar(250),@CatID int) ASBegininsert tblClient(Client_name,client_contact,Lient_tel,client_fax,client_webadd,client_email)values(@ClientName,@Contact,@Tel,@Fax,@WebAdd,@email)select @@identityinsert tblclient_cat(cat_id,client_id)values(@Catid,@@identity)(I tried to use this  sp but didnot work)as you can see I need help inserting the client_id just created by the db into the tblclient_cat since the cat_id is passed from the web formThanksErnesto

View Replies !   View Related
Why Can Not I Insert Data In My Tables
Hi I was watching this beginner webcast
Lesson 8:  Obtaining Data from a SQL Server 2005 Express Edition Database
http://msdn.microsoft.com/vstudio/express/visualcsharp/learning/#beginners
I tried to do the same exact thing.
But when I tried to insert data in the newly created table I got the follwoing error window:
Invalid value for cell (row1, column 2)Then changed value in this cell was not recognized as valid..Net Framework Data Type: Byte[]Error Message; You cannot use the Result pane to set this Field data to values other than NULL.
Type a value appropriate for the data type or press ESC to cancel change.
 
Any Idea why thing happing.
 
 
 

View Replies !   View Related
How To Insert Data In To Two Tables?
hi,
iam creating an asp.net application the database is created on the SQLSERVER, but i have a problem, i pretend to insert data in to 2 tables and i have no ideia how to do this. Can you help me to solve this problem? Please.....

View Replies !   View Related
How To Insert Data In To Two Tables?
hi,
i have got a problem, iam creating an asp.net application, but i pretend to insert data in two different tables, but i have no ideia how to do this.Can you help to solve this problem? please..........

View Replies !   View Related
How To Insert Data Into 2 Tables ?
hi all ,
I need to get data from textboxes and insert data into 2 tables. I tried as following code but it didn't work..
TextBox6 is primary key for Book and it's auto number field at access database ( So, if i run  "cmd = New OleDbCommand(str, cn)" then data will added to other colume and  the primary key will auto create .) .
But I need to insert the data into Inventory too using same button . B_ID is foreign key in Inventory to connect with Primary Key (which is Book_ID) at Book. How can I insert data into those 2 table using vb.net ? Thanks in advanced and will appreciate if you could provite the code sample too .


---
   Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim cmd2 As OleDbCommand
        Try
            cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C: estdb.mdb;")
            cn.Open()
              str = "insert into Book(Title,Arthur,Publisher,Year)" + " values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "')"
            Dim str2 As String = "insert into Inventory(B_ID,Price,Quantity)" + " values (" & TextBox6.Text & ",'" & TextBox7.Text & "','" & TextBox8.Text & "')"
            cmd = New OleDbCommand(str, cn)
            cmd = New OleDbCommand(str2, cn)
            cmd.ExecuteNonQuery()
            cmd2.ExecuteNonQuery()

        Catch ex As Exception
            MessageBox.Show("Error: " & ex.Message) 'catch error
        End Try
        cn.Close()
        Call EnableReadOnly()

    End Sub
 

View Replies !   View Related
Data Insert In Tables
I have timecard records need to be inserted into the EMP_TC table automatically.  This job should run every day to create EMP_TC records for the full current month for any ASSIGNMENT_ID€™s where ASGNMT_END_DATE is either null or greater than the run date of this job and PRD_START_DATE is in the current run month.
PRD_START_DATE is always Sunday, PRD_END_DATE is always Saturday.  For example, if an employee starts a new project on 4/8/2008, the first timecard record in EMP_TIMECARD for that EMP_ASGNMT_ID should be 4/6/2008 €“ 4/12/2008.  If PRD_END_DATE is null then the job would populate the following 4 records for the EMP_ASGNMT_ID:
 i have currently stored procedure doing this but i had to specify the dates manually .how could i automate this process.
i can avoid stored procedures needed but i am really confused on what logic to apply to it.
We need to pick the assigment id and dates automatically from employment assignment table.
Assignment id is nothinb but a identity coloum please advise
please advise
 
 
 
 
 

View Replies !   View Related
Copy Data From SQL Server To SQL Mobile
Hello

I'm developing an application that need to create everyday information to be stored in a SQL Mobile Database.

The SQL Mobile database will have:

Last schema from tables (in SQL Server database);
Last information in the tables;

I don't want to copy all the tables from SQL Server database than this mecanism should give me the way to choose the tables.

I have been reading about the SqlCeReplication but I don't undestand what is InternetUrl property. The SQL Mobile database is created in  the PC and after is copy to the the Mobile Device.
How can I avoid the InternetURL property?

tkx in advance
Paulo Aboim Pinto
Odivelas - Portugal

View Replies !   View Related
Insert Data In Multiple Tables
hi. can anyone help me, please.
i am using vwd2005 express edition and sql server 2005 express. i want to insert data in multiple tables at once. the tales are linked to each other through primary key and foreign keys. for example i have one table with a primary key. when i add data to it, i have to retrieve the id of the newly inserted record and then introduce this id in another  table as a foreign key. i have 10 tables linked in this way, and only one form to add data to the database.
can you help me, please? i'd be very greatful. thanks.

View Replies !   View Related
HELP ....difficulty In Insert Of 2 Tables Data With Id
 Hello frdz,             I have two tables in sqlserver 2005.             I have created the stored procedure for insert,update data.I m creating my application in asp.net with C#  Table-1 CUSTOMERFields:customerid int identity,cardid int,customername varchar(20) not null,address varchar(20) not null,city varchar(20) not null,emailid varchar(20) Table-2 CARDFields:cardid int identity,cardtype varchar(20) not null,carddetails varchar(20) not null INSERT INTO CUSTOMER (customername ,address,city,emailid) VALUES (@customername,@address,@city,@emailid) SELECT @customerid = SCOPE_IDENTITY()/* HELP HERE NOT ABLE TO GET DATA OF CARD */ SELECT @cardid = cardid from CARD where customerid =@cardid  Pls tell me how to insert the data ...There is only one cardid for only one customerid both should be unique no duplication....One customer can have only one and one card...  

 

View Replies !   View Related
Insert Data Into Related Tables
i am using ms sql server 2005 express for the following:

T1 = {t1.c1(PK), t1.c2, t2.c1(FK)}

T2 = {t2.c1(PK), t2.c2}

where T1 and T2 are tables from the same database, and tn.cn are CoulmnN of TableN
T1 and T2 are linked by the relationship t2.c1

i need to know how to add records to T1 and T2 using ms sql.

record for T2 needs to be added first then retreive t2.c1 from T2 to add record to T1 with t1.c1, t1.c2 t2.c1

please help, thanks

View Replies !   View Related
Compare And Insert Data On Two Tables
Hi everybody...
looking for a way to compare and insert data on two tables..

I have two tables

Tbl_email1
emailID email
1 info@sample1.com
2 info@sample2.com
3 info@sample3.com

tbl_email2
emailID email
1 info@sample1.com
2 info@sample4.com
3 info@sample5.com

I'm trying to compare tbl_email2 (email filed) with tbl_email1 (email field)
if the record exist it it does nothing if not it adds the email field in tbl_email1
the result would be

Tbl_email1
emailID email
1 info@sample1.com
2 info@sample2.com
3 info@sample3.com
2 info@sample4.com
3 info@sample5.com

thanks

View Replies !   View Related
Insert Data In Multiple Tables
Hi there!!! Trying to figure something out, I have searched this forum but no answer to my dilemma.

I have three tables on a database that I have to insert new data and update the old one. The structure of the tables is like this:

Table1
custid int primary key,identity
fname varchar(30)
lname varchar(30)

Table2
fileid int primary key, identity
ssn varchar(11)
custid int foreign key

Table3
statusid int primary key,identity
title varchar(18)
fileid int foreign key


This is very general but that's the idea. Now I receive a text file with the necessary info, I've already parse and break down the file into the correct fields.

Now for my question, how I insert the relevant data onto the tables from this one parsed file? and also how I go about inserting the primary keys from the different tables onto the foreign keys of each tables?

I tried relationships and key indexes, but it just spew a bunch of errors, that I'm investigating.

Any ideas, pointers, tuts, something I'm missing?

BTW I'm using sql 2005 express and VB.net


Thanks in advance for any help.


_José

View Replies !   View Related
SQL Server Mobile 2005 Merge Replication Problem On Windows Mobile 5.0
 

Dear ppl,

I am writing an application for a device (MDA Pro T-Mobile) having Windows Mobile 5.0 using

-MS .NET Compact Framework 2.0 SP-1 
-SQL Mobile 2005.
-VS 2005 .NET

The application uses Merge Replication. The error occurs in the Synchronise() Method of the SqlCeReplication object.

"SQL Server Mobile encountered problems when opening the database."

repl.AddSubscription(AddOption.CreateDatabase);
repl.Synchronize();

I don't understand why I am having this error. It does create the database on AddSubscription() method but it is failing opening the database on Synchronise(). I have also tried uninstalling and then reinstalling all the SQL Mobile components in the following order.

-sqlce30.wce5.armv4i.cab
-sqlce30.repl.wce5.armv4i.cab
-sqlce30.dev.ENU.wce5.armv4i.cab

However, when i run this application on a device(Dell X50 AXIM) with Pocket PC 2003, it runs fine creating the database and sysnchronising it.

The target platform for the project is Windows Mobile 5.0 Pocket PC SDK.

Does any one have any clue what could be the problem ?

Regards
Nabeel

 

View Replies !   View Related
Problem Using SQL Server Mobile 2005 With Windows Mobile 5 Application
Hello,

I am developping a non-managed C++ application for PocketPC using a SQL Server mobile database.

The application is compiled for PocketPC 2003 and uses SQL Server Mobile v2. I use Visual Studio 2005. But I need to compile the application for Windows Mobile 5.0 devices. So I installed the WM5 SDK and had the WM5 into my project configuration.

The "ssceoledb.h" which I include incluses the "transact.h" file. But my problem is that this file is only provided with the PocketPC 2003 SDK and not in the WM5 SDK.
So I cannot use the WM5 configuration project with SQL Server. I also tried with the last SQL Server Mobile 2005 (ie v3.0) and the "ssceoledb30.h" also includes "transact.h".

Did I miss something to install ?
Do you know how I can resolve the problem ?

By advance, thank you for any answer.

--
Gregoire

View Replies !   View Related
Synchronize Data Between Sql Mobile Db And Sql Server Db, Over Gprs
Hello!

I don't know if this question belong to sql forum or smart device forum.

So far i was able to sync data between pda and the sql server pc, over a wi-fi LAN using Remote Data Access.

Now i want to do the same but without using the wifi LAN, i mean, i want to be able to over a gprs connection, do the same data synchronization.

My main question is how to get access to the sql server database ? My connection string (obviously) only works in LAN.

My doubt is how can i access my sql server database data ?

I need some help over here, i really don't know how can i overcome my current problem.

Thank you

View Replies !   View Related
How To Transfer Data Between Sql Server Express And Sql Mobile?
Hi all,
Thanks in advance,
I have to transfer data from sql express 2005 to sql mobile(.sdf).
 
Actually i have a sql server express 2005 (sqlee) in laptop...
and the .sdf (sqlce) handheld device (ppc) that has been connected by activesync.
 
Can you please make it clear for my following questions?
1. Is it possible to write a query like " insert into ....sdf select from...sqlexp...." between 2 servers...?
2. Is there any copy command like a BULKCOPY .. to insert all records to .sdf (sqlce) from sql server express?


(or)
3. Is it correct to create a smart device application (CF 2.0) to transfer data between sql express and .sdf by using active sync...?
 
I would appreciate your comments..
 
Thanks,
Kumaran A

View Replies !   View Related
Problem With Saving Data To SQL Server Mobile ?
Hi everybody there

i have a small problem with this code, it cann't save changes on Datatable to the database SQL Server Mobile ..

the execution work succesfully but without changes in the database !

here is the code, please try to help :





Code Snippet

#Region " << Declarations >> "

    Dim objCon As New SqlCeConnection("Data source=Storage CardFull_Database.sdf")
    Dim objDA As SqlCeDataAdapter
    Dim objCmdBldr As SqlCeCommandBuilder
    Dim objTB As New DataTable("MyTB")
    Dim objBS As New BindingSource

#End Region

    Private Sub frmDatabase_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        objDA = New SqlCeDataAdapter("Select * From MyTB", objCon)
        objDA.MissingSchemaAction = MissingSchemaAction.AddWithKey

        objTB.Clear()

        objDA.Fill(objTB)
        objBS.DataSource = objTB

    End Sub

    ' Add New Record for example
    Private Sub mnuAddNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAddNew.Click

        If Not CType(objBS.Current, DataRowView).IsNew Then
            objBS.AddNew()

            Dim dRowView As DataRowView = objBS.Current
            dRowView.BeginEdit()

            dRowView("id") = 10
            dRowView("name") = "Someone"

            dRowView.EndEdit()
        End If

        ' Calling Save Methode
        mnuSave_Click(sender, e)

    End Sub

    ' Save Values
    Private Sub mnuSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuSave.Click

        objBS.EndEdit()
        objCmdBldr = New SqlCeCommandBuilder(objDA)
        objDA.Update(objTB)

    End Sub

View Replies !   View Related
Need To Insert Data Into 2 Tables, Relational Having Problems
Ok, I have a page on my website where we can add products to our database.  We are a music store, and most products have different versions or colors.  I've created 2 tables, Products and Subproducts.  The products table may hold info like Fender Stratocaster, and the subproducts would hold colors (Blue, Sunburst, etc).  The subproducts table has an integer field called MainProductID, which is linked to the mainproducts table field RecordID. So far the page uses a wizard where if first creates the main product using an sql datasource.  After the data has been added to the main products table, my page gives you the opportunity to add different sub products.  The problem I am having is actually feeding in the RecordID from the main products table to my insert parameter on the sub products data source.  This is what I have tried so far: There is a formview on the page that is bound to the main products table, after the entry is created I can physically see the info on my screen, so I know the data is there at my disposal SubProductsDataSource.InsertParameters.Add("@MainProductID", Formview1.datakey.item("RecordID"))SubProductsDataSource.Insert()Using this adds the data to the table, but the MainProductID is nullalso is there a cheap little way to refresh a page, because when I upload the product images I have it go to the next step where you are supposed to be able to see the images you uploaded, I don't see them which makes me think that the page is loading faster than the images are uploading.  Thanks   

View Replies !   View Related
Insert Same Data To Two Different Tables With One Submit Button....
I would like to insert a set of data to my database to 2 different tables.
what will be the SQL Statement for such ? Is it possible to do so?

for example, a webpage contain 2 textbox which require user to key in data. Once click submit button. the info will saved to 2 tables....

View Replies !   View Related
Insert Random Data Into Database Tables
 

Hi all
 

I have blank tables and i want to fill tables with data but i have many tables and i need script or whatever automated this operation like loop
 
thanks in advance
 
 
 

View Replies !   View Related
Insert Data Into Parent And Then Child Tables
hello -

i am trying to figure out how i can create an SSIS package to insert into multiple tables. After the first insert, I want to take the ID created (an Identity column) and then use that to insert into other associated (foreign key) tables.

For example, I have a table Users. The primary key is an Identity column. Once the SSIS insert is complete, the bulk load of new users has an identity ID value for each row. What I want to do, during the same SSIS package, is to take each row as it is inserted and add rows to other tables. Like, UserDepartment - it has a foreign key for the user id and a foreign key to the department being added. And, as part of this I will need to get the latest ID value and possibly some other values and store them in variables.

I looked at multi-cast, but I don't know/think that this will work for me.

does anyone know of a good example or article like this? 

thanks
- will

View Replies !   View Related
Cannot Build SQL Server Mobile Solution For Windows Mobile 5
Using MS VS 2005 (incl SQL Server Mobile)
MS Pocket PC 2005 SDK

I am working on a project that builds for Pocket PC on both Mobile 2003 and Mobile 5. The project uses/will use SQL Server Mobile to store local data.

Project created from new with support for both platforms. I include required header files ssceerr30.h and ssceoledb30.h.

Project builds fine in WM2003 configuration, release and debug.

When I build for WM5 the compiler cannot find the header file transact.h. This is included from within ssceoledb30.h. Same as under WM2003.

In WM2003 configuration if I highlight the ssceoledb30.h include in Visual Studio and open the header, it takes me to <Visual Studio dir>SmartDevicesSDKSQL ServerMobilev3.0. I then locate the include for transact.h and do the same, which takes me <Visual Studio dir>SDKPocketPC2003include. The file exists.

If I repeat the above 'browsing' under the WM5 configuration, ssceoledb30.h takes me to a different copy in the WM5 SDK directory. There is no diff between the file here and the other copy used by WM2003. If I attempt to open transact.h - file does not exist.

Fix (which I'm not too sure about, i.e. is it OK?) - If I copy transact.h to the WM5 SDK directory, the project builds.

Why has transact.h disappeared from WM5 SDK?
I can find no ref's to this problem anywhere. Is my installation of the WM5 SDK corrupt? What else could I be missing?
Is there a sample for SQL Server mobile (like the NorthwindOLEDB sample) that comes configured to build for WM5?

View Replies !   View Related
SQL Server Mobile Tutorial And Getting Proper Mobile DB Installation
Hi folks, I'm new to Windows Mobile progamming, and new to this forum. Apologies in advance if I'm asking a boneheaded question, but I've done searches and can't find anything directly applicable to my problem.

I'm currently walking through the published MS tutorial in setting up an SQL Server 2005 Mobile application that subscribes to a publication on SQL Server 2005 to exchange information.

I've gotten almost all the way through... successfully set up the server components, creating the publication, etc. On the mobile side, I've been able run the cab files to install the SQL Mobile components and to create the project, add the reference to the dll, and instantiate an engine object. It compiles.

The step in the tutorial after that, though, where you specify the data source from the "data" menu, I've got a problem. When I try to use the "new connection" dialog from choosing the data connection, "MS SQL Server Mobile Edition" doesn't show up as a choice. I've tried choosing any of the other combinations, and in teh subsequent "Connection properties" section my database, SQLMobile (as in their sample) is available, but I get an error when I choose it and click OK. Clicking on "Test Connection" gives me a connection successful message.

My guess is that something about the Mobile server side components is not installed correctly on my development machine, but honestly I have no idea how to begin to fix it. Has anyone seen this problem before and know how to resolve it?

Your time and any knowledge sharing is greatly appreciated.
Thank you,
-Dana

View Replies !   View Related
Data Source Problem In SQL Server Mobile Edition
Hi,

I am using SQLCE and VS 2005 to create a database named "student.sdf" (inside my projects folder, of course). When click on the button, it will test for connection of database.
Everytimes I run the program, it will pop up an error message "The database file cannot be found. Check the path to the database. [File name = .student.sdf]". How do I fix it?







Code Snippet

Imports System.Data.SqlServerCe


Public Class loginForm

    Private _conn As SqlCeConnection


    Private Sub ButtonLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonLogin.Click
       
        _conn = New SqlCeConnection("Data Source =.student.sdf")


        Try   
            _conn.Open()

            MessageBox.Show("Correct")

        Catch ex As SqlCeException

            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
        Finally

            _conn.Close()

        End Try

    End Sub



End Class


 

View Replies !   View Related
Microsoft SQL Server Mobile Edition Data Source
i just installed a copy of microsoft sql server 2005 in my pc and decided to follow the newbie's guide:

 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp?frame=true



anyway, on the 5th exercise wherein i'm supposed to add a new data
connection through the server explorer.. when i chose the option of
adding a new data source and was prompted to select a data source i
couldnt find the Microsoft SQL Server Mobile Edition data source..



is there anything else that i need to download in order to have that data source?

View Replies !   View Related
Using Push In RDA For Sync The Data From Sql Mobile To Sql Server 2005
Hi Everyone,

                  I have tried the Sync the data from sql server mobile (.SDF) to Sql server 2005 (.mdf).In push command, i am getting the error "Sql Server Everywhere encountered problems when opening the database".
string rdaOleDbConnectString = @"Provider=SQLOLEDB.1;User ID=sa;Initial Catalog=master;Data Source=PRASSANAPRASANNA;Password=master";
qlCeRemoteDataAccess rda = null;
try
{
rda = new SqlCeRemoteDataAccess();
rda.LocalConnectionString = "Data Source=D:/DATABASE/test.sdf";
rda.InternetUrl = http://localhost/Dataset/sqlcesa30.dll;
rda.Push("company", rdaOleDbConnectString, RdaBatchOption.BatchingOn);
MessageBox.Show("Completed");

}

catch (SqlCeException)

{



}



finally

{



rda.Dispose();



}

     please guide me any one ours guys  to solve this problem .

Thanks

Prasanna.

 

 

 

View Replies !   View Related
How To Insert Data Into Two Tables Simulatneously, Using Stored Procedure?
 
Hi all,I have heard that we must insert into two tables simultaneously when there is a ONE-TO-ONE relationship.
Can anyone tell me how insert into two tables at the same time, using SP?
Thanks
Tomy

View Replies !   View Related
Insert, Update && Delete On Two Tables With Same Data Structure...
I have created two table with same data structure. I need realtime effects (i.e. data) on both tables - Table1 & Table2.

Following Points to Consider.

1. Both tables are in the same database.

2. Table1 is using for data entry & I wants the same data in the Table2.

3. If any row insert, update & delete occers on Table1, the same effect should be done on Table2.

4. I need real time data insert, update & delete on Table2.

I knew that using triggers it could be possible, I have successfully created a trigger for inserting new rows (using logical table "Inserted") in Table2 but not succeed for update & delete yet.

I want to understand how can I impletement this successfully without any ambiguity.

I have attached data structure for tables. Thanx...

View Replies !   View Related
Merge Data From Two Tables Into One Table - No Updates/only Insert
 
Hi all,,
 
I posted the questions in sql forum and got good sql statement to work with it.. However, I want to see if there is a way to do it in SSIS..
 
May be this is really basic questions but I am having hard time to do it in sql server 2005 SSIS..
 
I have a flat file that I want to merge with table in SQL server 2005.
 
1> I have successfully created a data flow task to import data from flat file to Table X (new table I created for this package).
 
Now here is my question.
I have a Table A already in the database with the same column structure as of TableX (Both the tables have 20 columns/same Name/Same design).
 
I want to merge Table A and Table X and stored the data in TableA. However, I just don't want to merge blindly, I need to insert a new row in Table A only if the same row does not exist in Table A (there is no primary key, i am looking certain fields to see if the rows are same).. 
 
Here is an example:
Table A
--------------
1 test test1 test2 test3 test4 test5
2 test test6 test7 test8 test9 test10
 
Table X
------------
1 test test1 test2 test99 test4 test5
2 test test98 test97 test 96 test95 test94
--------------------------------------------------------
Now, I want to only insert row 2 of Table X since there is match on 4 of the fields in row1.. 
The new Table A should look like
 
NEW Table A'
-----------------
    
test test1 test2 test3 test4 test5
test test6 test7 test8 test9 test10
test test98 test97 test 96 test95 test94

 
------------------------------------
I think, I could do this using Execute SQL task and write all the code in sql, but that will be cumbersome and time consuming.. Is there a simpler way to achieve this?
 
Thanks in advance.
 

View Replies !   View Related
How To Import Data Into SQL Server 2005 Mobile Edition Database?
There are any import/export utilities for SQL Server 2005 Mobile Edition database? Which edition of SQL Server 2005 can do this?

Or we must use publication/subscription to transfer data to the mobile database?

Thank you for your help!

View Replies !   View Related
Loading Data In SQL Mobile 2005 From The Server Side And Not On The Handheld
Hello,

We are in need of some help around the use of SQL Server 2005 Mobile Edition.

The problem comes in when we have to import a large list of equipment ID€™s into the database.

The way that things work today is that the database only runs on the handheld computer, so we are having to process a large amount of data on the handheld therefore taking a lot of time.

If there were a way to have a €śseed€? database on the server side (running on Windows Server 2003 or similar) and import all of this data on the server side it would be more efficient and require less time.

Once the data was imported on the server side we can simply transfer this seed database down to the handheld

Could you please throw some light on the above queries.

Thanks in advance.

Jeeves

 

 

View Replies !   View Related
How To Add Data In Sql Mobile Database From Sql Server 2005 Management Studio
 

Hi,

After creating mobile database into sql server 2005 management studio, how to insert the records from sql server 2005 management studio into and mobile database from excel file?

Thank you

Prashant

View Replies !   View Related
SQL Server 2005 Mobile Edition ANd SQL Server CE - SHould I Have Uninstalled Mobile First ?
 

Hi:
 
When I try and connecto to SQL CE I always get an invalid operation exception.  I"m afraid that I did not follow the proper install for Orcas Beta 2.  I can't remember if I was supposed to uninstall SQL Mobile 2005 first or not.
 
All I know is when I try and use my SQL CE I can't connecto to a DB / sdf file ?
 
Any help would be appreciated I"m just starting to use SQL CE.
 
thanks
mark
 

View Replies !   View Related
Insert Data From Flat File Into Serveral DB Tables Having Many-to-many Relations
Hi everyone,

I am new to SSIS and I thought maybe someone would give me tips for solving the problem I am facing.
 

Overview:
I want to insert data contained in a flat file into several DB tables, which have N-M relations.

For illustration, I would explain the problem on a very simple DB:
1. The database contains the following 3 tables:
EMPLOYEE (EMP_ID, EMP_NAME)
PROJECT (PROJ_ID, PROJ_NAME)
EMP_PROJ (EMP_ID, PROJ_ID) , where EMP_ID and PROJ_ID are foreign keys referencing records in the EMPLOYEE and PROJECT tables respectively.
 

2. Each entry in the falt file contains the following data:
EMP_ID, EMP_NAME, PROJ_ID, PROJ_NAME
 

3. In SSIS, I have created a Data Flow Task containing:
- a path from a Falt File Source to an SQL Server Destination (Table: Employee)
- a path from a Falt File Source to an SQL Server Destination (Table: Project)
- a path from a Falt File Source to an SQL Server Destination (Table: Emp_proj)

Note: I used SQL Server Destination, because I need to import a huge amount of data and I read that this component performs better than the OLE DB Destination!

 
Questions:
1. I would like to eliminate EMP_ID and PROJ_ID from the Flat File Source. Instead, I would like these fields to be generated automatically upon insertion.
a. How can I do this and propagate the generated key among the different paths, which I have explained previously?
b. Can I first generate the two keys somehow then the parallel insertions into the different tables should start using the generated keys?
 

2. Is my solution correct in the first place? Or is there another better way for inserting data which belong to N-N relations?

 
Thanks in adavance,
Samar

 
 

View Replies !   View Related
Correct Way To Insert Data Into Multiple Tables (Stored Procedure)
 

Hi
 
I am currently developing my first database driven application and I have stumbled over some quite simple issue. I'll describe my database design first:
I have one table named images(id (identity), name, description) and one table named albums (id, name, description). Since I'd like to establish a n:n connection between these, I defined an additional table ImageInAlbum (idImage, idAlbum). The relation between these tables works as expected (primary keys, foreign keys appear to be ok).
 
Now I'd like to insert data via a stored procedure in sql server 2005 and I'm not sure how this procedure will look like.
To add a simple image to a given album, I am trying to do the following:
* Retrieve name, description from the UI
* Insert a new row into images with this data
* Get the ID from the newly created row
* Insert a new row into "ImageInAlbum" with the ID just retrieved and a fixed Id from the current album.
 
I know how I would do the first two things, but I am not used to Stored Procedures syntax yet to know how to do the other things.
 
Any help is appreciated ... even if it means telling me that I am doing something terribly wrong

View Replies !   View Related
SQL Mobile Create Sdf File From SQL 2005 DB
Hi,

I'm trying to create a SQL Mobile .sdf file from my SQL Server 2005 database and cannot.  I read the ms support docs for doing this and have had no luck . I created the respective publication and SQL Subscription for the db and when i run the process (not sure if i'm running the right process - docs don't say) it creates a directory under a "unc" directory with all my table objects (articles) with subscription/replication files for each table such as .cft, .bcp, .dri, .prc, .sch, and .trg.  But no .sdf file for my SQL Server 2005 database. 

All I want is the .sdf file so that i can copy it to my Pocket PC device and then connect my mobile application to it.  I want to copy my SQL Server 2005 database to my device so that the mobile app uses the db on the device.  Sounds easy - but it's not.  Can someone tell me the easiest way to do this or point me to a doc that explains it.  I checked the ms support docs and they state "after the .sdf file has been created..."  in "Pre-building a SQL Server Mobile Database" doc.  Where/How is the .sdf file created is what I would like to know?

Any help would be appreciated.

Thanks - Dave

 

 

 

View Replies !   View Related
Create Mobile Database From Xls, Csv, Text Or Mdb
Hello,

Since my experience in VS is extremely limited, i'd like to be exused if questions sound silly.

My problem is that, at my device application project, i want to build a database that will retrieve data from .xls, or .csv, or .txt, or .mbd files. If i've noticed well, there is no support for OLEDB or ODBC, since by the time that i add tableadapter to my database.xsd and use these, after insertion i get multiple errors informing that system.data.oledb. ....  or .odbc  "type is not defined".

If it cannot be done, and since i still try to figure out how smart devices function, transact with databases, e.c.t. is there any suggestion?

 

Thank you in advance

Kostas

View Replies !   View Related
Create A Mobile Database On Desktop
I have searched through this forum and the news group

microsoft.public.sqlserver.ce

for this topic. I only find a post from Darren Shaffer and I requested a document.

Unfortunately, there is not a clear example of how to create a mobile database (sdf) on a desktop machine which contains VS 2005 and SQL server 2005  by using Visual Basic 2005.

I am sure a clear example in VB for this problem would help a lot of people. Hence anybody who knows how to perform this task, Please help these people.

Thanks in advance

Talat

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved