Help With Inserting WMI Query Into SQL

Jan 18, 2007

Hi, I'm a compleate noob and trying to learn c# and wmi. I have used WMI queries in vbscripts but I want to take things a bit further now and read a server name from a SQL db and query WMI (eg. disk space available) then record it back into SQL. I'm really struggling on how to do this.

I written the code to query WMI (SELECT * FROM Win32_LogicalDisk) but referencing it to DB's is something I can't do!

Can anyone help with this?

View 1 Replies


ADVERTISEMENT

Inserting One Query Before Another

Jul 23, 2005

I am having trouble inserting two queries...I am trying to insert annew item(pk) into a table in one query, and then inserting an item(fk)in another table that relates to the other item just created in thefirst. The problem is that in order for the second query to work, thefirst has to exist in the first table before it will work. Is there away of running the first query first and then the next. Here is what Ihave:<cfquery name="q_insert" datasource="#dsn#">INSERT INTO eccn(eccn_num,eccn_brief_descrip,eccn_full_descrip,eccn_reason_controlled)VALUES('1D001','TEST','TEST INPUT AND SEARCH','TESTING THE INPUT AND SEARCH PERFORMANCE')</cfquery><cfquery name="q_insert2" datasource="#dsn#">INSERT INTO eccN_interrelationship(eccn_num,related_eccn_num)VALUES('1D001','1B001')</cfquery>

View 1 Replies View Related

Inserting A JOIN In This Query?

May 12, 2006

Hi folks, I'm having some trouble here.

In a database, there's a table that contains information about items or units in a flow; tbl_item. One of the columns is named SubLocationID (int) and it says where in the flow the unit is located.

Another table is called tbl_sublocation, and it contains information on each sublocation, where of course SubLocationID is the primary key. In this table, there's a column named SubLocationName which gives the user a name to relate to instead of just a number.


Code:


SELECT
SubLocationID,
count(SubLocationID) AS Units

FROM
tbl_item

GROUP BY
SubLocationID

HAVING (COUNT(SubLocationID) > 1)



Now, I use this query to get information if there's any sublocations that have two or more items on them. It works just fine, but I want to display SubLocationName from tbl_sublocation instead of SubLocationID, and I just can't figure out how.

Anyone got any sugestions? Thanks in advance.

View 4 Replies View Related

Inserting Variables Into A Query Using SqlDataSource

Jan 4, 2008

 Hi all,
I was wondering if anyone can help me figure out how to insert a
variable into a query using Visual Studio 2005 with the SqlDataSource
control. I cant seem to be able to enter a var into the query
parameters.

this is my SqlDataSource:
        <asp: SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:imLookinLikeConnectionString
%>"            DeleteCommand="DELETE FROM [tblDiaryEntries] WHERE [DiaryEntryID] = @DiaryEntryID"           
SelectCommand="SELECT tblDiaryEntries.DiaryEntryID,
tblDiaryEntries.EntryDate, tblDiaryEntries.Subject,
tblDiaryEntries.DiaryEntry, aspnet_Users.UserName FROM tblDiaryEntries
INNER JOIN aspnet_Users ON tblDiaryEntries.UserID = aspnet_Users.UserId
WHERE UserName=@UserName ORDER BY tblDiaryEntries.EntryDate DESC"           
UpdateCommand="UPDATE [tblDiaryEntries] SET [DiaryEntry] = @DiaryEntry,
[EntryDate] = @EntryDate, [Subject] = @Subject WHERE [DiaryEntryID] =
@DiaryEntryID" InsertCommand="INSERT INTO tblDiaryEntries(UserID,
EntryDate, Subject, DiaryEntry) VALUES (@UserId, GETDATE(), @Subject,
@DiaryEntry)">            <DeleteParameters>                <asp: Parameter Name="DiaryEntryID" Type="Int32" />            </DeleteParameters>            <UpdateParameters>                <asp: Parameter Name="DiaryEntry" Type="String" />                <asp: Parameter Name="EntryDate" Type="String" />                <asp: Parameter Name="Subject" Type="String" />                <asp: Parameter Name="DiaryEntryID" Type="Int32" />            </UpdateParameters>            <InsertParameters>                <asp: Parameter Name="DiaryEntry" Type="String" />                <asp: Parameter Name="EntryDate" Type="String" />                <asp: Parameter Name="Subject" Type="String" />                <asp: ProfileParameter DefaultValue="Anonymous" Name="UserName" PropertyName="UserName" />                <asp: Parameter Name="UserId" />            </InsertParameters>            <SelectParameters>                <asp: ProfileParameter DefaultValue="Anonymous" Name="UserName" PropertyName="UserName" />            </SelectParameters>        </asp: SqlDataSource>
What I want to do is to tell the SqlDataSource that  @UserName = this.User.Identity.Name, but I only know how to do that in
code-behind, not sure how to insert it into the code above.Any ideas?

View 3 Replies View Related

Error Inserting To Database: Parameterized Query

Jun 11, 2008

Hi, Im struggling with this insert statement, I want to use with a AJAX validation Post Form page.
Its quite straght forward, if a search query returns null the insert these values. The search query does work, what I mean by that is that txt field values seem to pass for search but not insert. Any help out there cheers Paul if (RowCount == 0)
{String strSQL = "INSERT INTO Mail_List (FirstName, Email) VALUES( @FirstName, @Email )";
 
try
{mySqlConn = new SqlConnection(strSqlConn);
mySqlConn.Open();SqlCommand cmd = new SqlCommand();
cmd = new SqlCommand(strSQL, mySqlConn);cmd.Parameters.AddWithValue("@FirstName", Request.Form["FirstName"]);cmd.Parameters.AddWithValue("@Email", Request.Form["Email"]);
cmd.ExecuteNonQuery();
lblStatus.Text = "Registration Successful";
}

View 2 Replies View Related

Inserting Serial No Column In Result Of A Query

Apr 21, 2005

Hello Friends
                     My problem is
                     Suppose Query is - Select * from tbl_Employee
                     TBL_EMPLOYEE HAS ONLY TWO COLUMNS NAME,POST
                     I need that an extra column get inserted in result through query showing serial Number with each row.So that query result look like this.
                     Serial   Name Post
                        1      XYZ   QER
                        2      SDF   OPO
                        3      WER   IPO
            If any body knows please post the solution its urgent.

View 11 Replies View Related

Dynamically Inserting A List In WHERE Clause Of A Query

Jul 8, 2014

What I need?: A way of dynamically inserting a list in the WHERE clause of a query. (in the form, WHERE ID = 1,2,3,6,9 etc)

Imagine an example DB with 3 columns Student ID, Name, Teacher_ID. (Lets assume Teacher_ID with value 100 means its the Headmaster)

I need to create a list with Student ID's, who are directly/indirectly under the Headmaster. Example:

Headmaster
Teacher 1 (ID 200)
Teacher 2 (ID 250)
Student 1 (ID 300)
Director
Teacher 4
Student 5

In the above example, since I only want those students/teachers under the headmaster, either directly/indirectly, my list would contain Teacher 1, Teacher 2, and Student 1. (In my case, just their ID's, so 200, 250, 300)

Director, Teacher 4 and Teacher 5 wouldnt be in the list since theyre not directly/indirectly Headmaster.

View 2 Replies View Related

Inserting Results From Query Into New Temp Table

Sep 17, 2013

I am try to insert the results from the query into new temp table but keep geeting an error for Incorrect syntax near ')'.

select * into tempCosting
from
(
select top 10* from itemCode itm
where itm.type= 1
)

View 3 Replies View Related

Inserting Into A Tmp Table Using A View --- Please Help Using SQL Query Analyzer

Nov 30, 2006

Hi there,I struggle to get this going i would like to insert data into 2 tmptables in a view.If i run the code on it's own it works perfectly until i want to createa view it complains about the INSERTthis is my codeCreate view dbo.vew_SwitchesAsINSERT INTO tmpInsSelectDistinctBIV.DATE,BIV.ID,CA.NAME,BIV.IND,BIV.AMOUNT,BIV.UNITS,BIV.INAME,MB.NOfrom Cars BIVLEFT JOIN MountainBikes MBON MB.ID = BIV.IDAND MB.CLASS = BIV.CLASSAND MB.NUMBER = BIV.NUMBERAND MB.DATE = BIV.DATELEFT JOIN Caterpillars CAON CA.ID = MB.NOwhere BIV.CLASS = 'SWCH'and BIV.IND = 'IN'AND BIV.UNITS = 0AND BIV.AMOUNT <0ORDER BY BIV.DATE ASC------ Step 2 -------Into tmpOutsInsert Into tmpOuts ---- All Switches In ----SelectDistinctBIV.DATE,BIV.ID,CA.NAME,BIV.IND,BIV.AMOUNT,BIV.UNITS,BIV.NAME,MB.NOfrom Cars BIVLEFT JOIN Mountainbikes MBON MB.ID = BIV._IDAND MB.CLASS = BIV.CLASSAND MB.NUMBER = BIV.NUMBERAND MB.DATE = BIV.DATELEFT JOIN Caterpillars CAON CA.ID = MB.NOwhere BIV.CLASS = 'SWCH'and BIV.IND = 'OUT'AND BIV.UNITS = 0AND BIV.AMOUNT <0ORDER BY BIV.DATE ASC----------------------Step 3 ----------------SelectDistinctins.DATE,ins.ID,ins.NAME ,insIND,ins.AMOUNT/100 as AmountIn,outs.IND,outs.AMOUNT/100 as AmountOut,outs.NAME


Quote:

View 4 Replies View Related

Query Notification Stopped Working When Inserting Row

Mar 27, 2008

I'm using query notifications and it worked fine as long as I just edited the data that the "query points to" (one table). That is, my graphical represenation of the data (in a gridview) was updated correctly with the new data 1ms after I changed it, just like it should.

When I inserted a new row to the table the query notification stopped working, meaning my gridview wasn't updated. Any idea of why? Also, after this, not even editing of the data made the query notification trigger so it must have totally stopped.

Thanks in advance
ripern

View 3 Replies View Related

Change In Query For Inserting Float Values

Jan 2, 2008



Hi

I was using a simple query to insert data in fields of type decimal


INSERT INTO Table (stringValue,intvalue) VALUES ('myString ',

" + numericvalue + ")



a query looked like this

INSERT INTO Table (stringValue,intvalue) VALUES ('myString',125)

I had to make a change to accept float point values ( 0,012 ) so I change the fields from decimal to float in the DB

Now I'm having problems in the query because of the comma. The new query looks like this

INSERT INTO Table (stringValue,intvalue) VALUES ('myString',0,012) so because of the comma the engine see three values instead two

How can write the query to insert this float values?

thanks

View 4 Replies View Related

Problem With Making A Sqldatasource For Inserting Using The Query Builder

Aug 19, 2007

I want to make a sqldatasource to insert data ito a table with values from textfields page. I want to use the sqldatasource programically (not bind it to a formcontrol).
I drag a sqldatasource from the toolbox to the design surface and start configuring the datasource. I spesify a custom sql statement, select the "Insert" tab and insert the table I want to store into the builder. Then I select the fields and the values (parameters from tue textfields. I test it with the "Execute query" button and the results is stored in the table. (everything seems ok) I press the "OK" button but both the "Next" and "Finish" buttons are dissabled, o I can not store the query.
What is going wrong. Can someone please help me ?
Tom Knardahl

View 2 Replies View Related

Problem In Inserting Date In Sql Server 7 Through Insert Query

Jul 20, 2005

hello myself avinashi am developing on application having vb 6 as front end and sql server 7as back end.when i use insert query to insert data in table then the date value ofthat query is going as 01/01/1900my query is as followsStrSql = "Insert IntoSalesVoucher(TransactionID,VoucherNo,VoucherDate,D ebitTo,CreditTo,TotalAmt,Discount,ModAmt,ModWt,Oth er,Othertype,TaxPerc,TaxAmt,NetAmt,Advance,Narrati on,Haste)"StrSql = StrSql & " Values(" & txtTransactionID.text & "," &txtChallanno.text & ",'" & Format(txtChallanDate.Value, "dd/mm/yyyy") &"'," & AccCode & ",'" & IIf((Category = "Gold"), 36, 38) & "',"StrSql = StrSql & vsAmountDesc.ValueMatrix(RowAmountArr(0),2)& "," & vsAmountDesc.ValueMatrix(RowAmountArr(2), 2) & "," &val(txtModTotal.caption) & "," & val(TxtModWt.caption) & ","StrSql = StrSql & vsAmountDesc.ValueMatrix(RowAmountArr(1),2)& ",'" & vsAmountDesc.TextMatrix(RowAmountArr(1), 1) & "','" &vsAmountDesc.TextMatrix(RowAmountArr(4), 1) & "'," &vsAmountDesc.ValueMatrix(RowAmountArr(4), 2) & ","StrSql = StrSql & vsAmountDesc.ValueMatrix(RowAmountArr(3),2)+ val(txtModTotal.caption) & "," & val(txtAdvance.text) & ",'-'," &IIf(Trim(txtHaste.text) <> "", RetriveAccountCode(Trim(txtHaste.text)),0)& ")"and its output isInsert IntoSalesVoucher(TransactionID,VoucherNo,VoucherDate,D ebitTo,CreditTo,TotalAmt,Discount,ModAmt,ModWt,Oth er,Othertype,TaxPerc,TaxAmt,NetAmt,Advance,Narrati on,Haste)Values(18,1831,'07/04/2004',150,'36',11000,0,0,0,-10,'','1.00',109.9,11100,0,'-',0)in above query though i used cdate to voucherdate value still it save indatabase as 01/01/1900 though here it shows right dateplz help me its a very big issue for me & i really just fed of thisproblem

View 2 Replies View Related

Problem Inserting Sql Query Into Database Float Datatype Field Using SQL Transaction

Aug 22, 2006

I have this problem of inserting my query into database field. My code is as of below.
The @AVERAGESCORE parameter is derived from
Dim averagescore As Single = (122 * 1 + 159 * 2 + 18 * 3 + 3 * 4 + 0 * 5) / (122 + 159 + 18 + 3 + 0)
and the value returned is  (averagescore.toString("0.00"))
However, I have error inserting the averagescore variable into a field of datatype float during the transaction. I have no problems when using non transactional sql insert methods. What could be the problem?
  Try
Dim i As Integer
For i = 0 To arraySql.Count - 1
myCommand = New SqlCommand
Dim consolidatedobjitem As ConsolidatedObjItem = arraySql(i)
myCommand.CommandText = sqlStr
myCommand.Connection = myConnection
myCommand.Transaction = myTrans
With myCommand.Parameters

.Add(New SqlParameter("@AVERAGESCORE", consolidatedobjitem.getaveragescore))

End With
myCommand.ExecuteNonQuery()
Next
myTrans.Commit()
myConnection.Close()
Catch ex As Exception
Console.Write(ex.Message)
myTrans.Rollback()
myConnection.Close()
End Try 

View 7 Replies View Related

Inserting Data Into Two Tables (Getting ID From Table 1 And Inserting Into Table 2)

Oct 10, 2007

I am trying to insert data into two different tables. I will insert into Table 2 based on an id I get from the Select Statement from Table1.
 Insert Table1(Title,Description,Link,Whatever)Values(@title,@description,@link,@Whatever)Select WhateverID from Table1 Where Description = @DescriptionInsert into Table2(CategoryID,WhateverID)Values(@CategoryID,@WhateverID)
 This statement is not working. What should I do? Should I use a stored procedure?? I am writing in C#. Can someone please help!!

View 3 Replies View Related

Inserting Data To Text File From Database And Inserting Data Back To Database From Text File

Aug 7, 2007

Hello friends....
I am looking for 2 things(using c#.net or vb.net and sql svr 2000)
1.convert data from sql server 2000 database (say customers table from northwinds database) to a text file(separated by commas or just plain space)
2.Insert the data from text file back to database.
Can someone pls give me the detailed code to achieve this....really need this on urgent basis.......Thank You.

View 10 Replies View Related

Inserting '

Jan 16, 2008

How can I insert a value that includes '  ?
My insert string looks like this: "INSERT INTO table(field1) VALUES ( ' " + value1 + " ' )"
When value1 has ' in it, I get an error.

View 5 Replies View Related

Inserting More Than 1 Value

Sep 30, 2005

I have the following code for SQL2000:
It only works if the sub-query returns only 1 values.... anyone knows how I can solve this?
thx a lot!!!

INSERT INTO Table1(SourceName, CreatedBy, CreateDate, IsSuccess, datadate)
SELECT 'Data_01', user, GetDate(), 1,
(
SELECT DISTINCT T1_Dummy.[TRANSACTION DATE]
FROM T1
WHERE T1.[TRANSACTION ID] NOT IN
(
SELECT T.TRANSACTION_ID
FROM T
)
)
FROM T1
GROUP BY [Transaction Date]

View 3 Replies View Related

Inserting And Then Getting The Key

Apr 4, 2007

Hi,

I am moving one database to another (different scemas) using SSIS. The destination database uses autogenerated keys. In order to preserve referential integrity I have to keep track of the keys generated when doing inserts in various tables. I use a staging table to save the keys generated by the insert command. I use this as a lookup table later on to find the foreign keys in order to link newly inserted records. The only way that I could find to get the key back after an insert was to create a Script component that does the insert and then executes "SELECT @@IDENTITY". After that I use an OLE DB Command to update the record in the staging database. Is there a better way of doing this? It seems to me that this is not a proper use of the Script component, but if I want to use OLE DB destination or OLE DB Command I cannot get the key back. Also, I am not allowed to use any stored procedures or change the destination database in any way.

View 4 Replies View Related

LOCK DB WHEN INSERTING

Jul 19, 2006

Hello.
I need to insert some records to an accounting table and calculate the balance after that. Thus, other users can be trying to do the same. How to lock the db and make the other users wait until the right moment? I'm using SqlDataSource to do that.
Thanks.

View 7 Replies View Related

Inserting A Default Value

Sep 3, 2006

I have populated an SQLdata table from an XML datasource usinmg the bulk command. In my SQL table is a new column that is not in the XML table which I would like to set to a default value. Would anyone know the best way to do this. So far I can's see how to add this value in the Bulk command. I am happy to create a new command that updates all the null values of this field to a default value but can't seem to do this either as a SQLdatasource or a APP Code/ Dataset. Any suggestions or examples where I can do this.Many thanks in advance

View 1 Replies View Related

Help On Inserting Data To DB

Sep 11, 2006

Hi,I m using Microsoft Visual Studio 2005 and SQL server 2000. I have 2 textboxes and a button, what i wanna do is, when i hit the button, the values in textboxes should be inserted into DB. Would you please help me? Thanks in advance.

View 1 Replies View Related

Inserting 100 Records

Jan 17, 2007

How to insert 100 record at a time by explicit inserting of identity column i.e.., by setting identity column to false

View 4 Replies View Related

Inserting Data Into DB

May 5, 2007

Hi friends,I have one text box on my form.i need to insert the data from tat text box to DB without clicking on any button.Now i have written the code under text changed event of that text box.So it is inserting whenever i click on that form.Besides this i need to insert data when i close tat window.But it is not inserting when i close tat window.Plse help me.Thanks in advance
With RegardsLijo Rajan

View 1 Replies View Related

Inserting Data

Jun 6, 2007

I have created a form with several fields etc and validation.

After pressing the submit button i have a

if Page.IsValid then .....etc
But in this then bit I want to do a

INSERT the form details to the db.

I have done inserts etc via gridView etc but I just need a form that lets someone enter info and submit etc, so do not now where to or how to place this code to connect then insert etc

thanks

View 3 Replies View Related

Why Is This Trying Errors, (SQL Inserting)

Sep 18, 2007

Why on earth is this not working,  It WILL insert if there are NO apostheres (" ' "), but if I say like, "Cedric's Group" It will error out.  I thought this approach was suppose to handle this character?
Thanks for any insight, String sqlStr = "Insert into cardgroups (username,groupname,insertdt,groupid) values (@username,@groupname,@insertdt,@groupid)";

SqlCommand cmd = new SqlCommand(sqlStr, connect);

cmd.Parameters.AddWithValue("@username", Session["memberusername"].ToString());

cmd.Parameters.AddWithValue("@groupname",this.namebox.Text.ToString());

cmd.Parameters.AddWithValue("@insertdt", DateTime.Now.ToString());

cmd.Parameters.AddWithValue("@groupid", myGroupStr);

connect.Open();

cmd.ExecuteNonQuery();

connect.Close();
 

View 2 Replies View Related

Text Inserting

Oct 21, 2007

I fixed all the free text stuff but now I have another problem. I created a web app one page to enter data and anoter to display it. I have a multiple row text box and if you enter something with returns it it when you display the data it ignores the returns and puts everything on the same line  BTW the column type is text
 
example
 
this
"want to hest this out.
========================
 
now I am going to put in some test data and see how it comes out
 
finished"
 
will come out like this
"want to hest this out.========================now I am going to put in some test data and see how it comes out finished"
 
how do you fix this?

View 16 Replies View Related

Problem When Inserting

Nov 12, 2007

I want to insert a recorde into my table (2 column) : name and Id
id is a primary key and this is the error MSG im getting everytime im trying to insert a record
Error:Cannot insert explicit value for identity column in table 'Customer' when IDENTITY_INSERT is set to OFF.
what is the problem


here is the code :protected void Button2_Click(object sender, EventArgs e)
{
try
{string str = "data source=.;integrated security=true; initial catalog=NH_Project2";
SqlConnection conn = new SqlConnection(str);SqlCommand comm = new SqlCommand("insert into [Customer](Name,Id) values(@custName,@custId)", conn);
comm.CommandType = CommandType.Text;comm.Parameters.AddWithValue("@custName", TextBox1.Text);comm.Parameters.AddWithValue("@custId", TextBox2.Text);
conn.Open();
int rowaff = (int)comm.ExecuteNonQuery();if (rowaff == 1)
{Label4.Visible = true;Label4.Text = "one customer has added to our data base";
}
else
{Label4.Visible = false;Label4.Text = "not added try again";
}
}catch (Exception ex)
{ Response.Write("Error:" + ex.Message);
 
}
}

View 6 Replies View Related

Inserting Into More Than 1 Table

Jan 9, 2008

Hey all,
Quick question for ya.  If I wanted to insert 1 value into 1 table and another value into another table, how would I do that with closing connections and reopening and whatnot?  I am using Visual Web Dev and SQL server 2005 express.  I have been trying to mess around with it but I can't figure it out.  Here is the situation.
I want to insert a GroupName and GroupDescription that a user fills in in 2 text boxes named GroupNametxt and GroupDescriptiontxt.  This data will go into the "Group" table.
I then also want to Insert the data UserID (taken from the aspnet ID table), and GroupName from the Grouptxt.text into a GroupMembership table.
How would I do all this in 1 button click?  I know some basic TSQL but I don't know how to handle the opening and closing of connections and whatnot. 
Thanks,
Chris

View 2 Replies View Related

Inserting Just Times

Jan 20, 2008

When using a SQL Server DateTime column to store just times, e.g. '6:00 PM' I've noticed some weird inconsistency.
If I insert a time in a SQL statement, such as... INSERT INTO myTable (StartTime) VALUES ('6:00 PM')
It winds up going in as  '1/1/1900 6:00 PM'.  This is okay.  This is in fact what I want (unless of course the base day for sql server is in fact 12/30/1899, which is my next question).
If, on the other hand, I insert a time value by hand, using SQL Server Management Studio, then after I insert '6:00 PM' it winds up as '<Today's Date> 6:00 PM', i.e. '1/20/2008 6:00 PM'.
Also, if I insert it using a SQL Parameter, such as...
da.InsertCommand.Parameters.Add("@StartTime", SqlDbType.DateTime, 8, "StartTime")
...Then, if StartTime is 6:00 PM again, it also winds up going in as '<Today's Date> 6:00 PM'. 
Is there a way to control this behavior (other than to programmatically append a base date to the time I'm inserting)? 
Finally, what is the base day for SQL Server 2005?  Is it 1/1/1900 or 12/30/1899?  I think I've seen both. 
Thanks!
Aaron

View 3 Replies View Related

Not Inserting Dropdownlist

Jan 30, 2008

Hi folks,
I'm in trouble getting an dropdownlist inserting its selected value into an .mdb
I'll insert my datasource code. There is another dropdownlist in this formview working good.
There is a datafield ID_Org_Einheit in the database to gather the value.
Could you please look this over?
Many thanks
Rosi
 
 
This is the dropdownlist
<asp:DropDownList ID="DDL_Org_alle" runat="server" DataSourceID="SDS_Org_alle" DataTextField="OE_gegliedert"
DataValueField="ID_org">
</asp:DropDownList>
and the datasource
<asp:SqlDataSource ID="SDS_insert_FB_log" runat="server" ConnectionString="<%$ ConnectionStrings:FahrtenbuchConnectionString %>"
 
InsertCommand="INSERT INTO tab_Fahrtenbuch_log([Datum_Eintragung], [Fahrer], [ID_Org_Einheit], [pol_Kennzeichen], [ID_Einsatzzweck], [Strecke_von], [Strecke_bis], [Zeit_von], [Zeit_bis], [km_von], [km_bis]) VALUES (@Datum_Eintragung,@Fahrer,@ID_Org_Einheit,@pol_Kennzeichen,@ID_Einsatzzweck,@Strecke_von,@Strecke_bis,@Zeit_von,@Zeit_bis,@km_von,@km_bis)" ProviderName="<%$ ConnectionStrings:FahrtenbuchConnectionString.ProviderName %>"
SelectCommand="SELECT Datum_Eintragung, Fahrer, ID_Einsatzzweck, Strecke_von, Strecke_bis, pol_Kennzeichen, ID_Org_Einheit, Zeit_von, Zeit_bis, Bemerkung, km_von, km_bis FROM tab_Fahrtenbuch_log">
<InsertParameters>
<asp:FormParameter FormField="Datum_EintragungTextBox" Name="Datum_Eintragung"/>
<asp:FormParameter FormField="FahrerEintragTextBox" Name="Fahrer"/>
<asp:FormParameter FormField="DDL_Org_alle" DefaultValue="1" Name="ID_Org_Einheit"/>
 
<asp:FormParameter FormField="polKennzTextBox" Name="pol_Kennzeichen"/>
<asp:FormParameter FormField="DDL_Einsatzzweck" DefaultValue="1" Name="ID_Einsatzzweck" Direction="Input" Size="3" /><asp:FormParameter FormField="StartTextBox" Name="Strecke_von"/> <asp:FormParameter FormField="ZielTextBox" Name="Strecke_bis"/>
 
<asp:FormParameter FormField="AbfahrtTextBox" Name="Zeit_von"/>
<asp:FormParameter FormField="AnkunftTextBox" Name="Zeit_bis"/><asp:FormParameter FormField="kmFahrtBeginnTextBox" Name="km_von"/> <asp:FormParameter FormField="kmFahrtEndeTextBox" Name="km_bis"/>
 
</InsertParameters></asp:SqlDataSource>
 

View 3 Replies View Related

Inserting Into A Sql Table

Feb 15, 2008

VWD 2005 Express.  Visual Basic.  Sql Server 2005.
How may I insert a record into a table from code behind (I am doing this without any entries to a form).  The connection name is GoodNews_Extranet.  The table is Login.  The fields I want to write are UserId and dtTime.  Thanks for any help.  The insert command is:
INSERT INTO [Login] ([SystemUserId], [dtTime]) VALUES (@SystemUserId, @dtTime)
I will provide the @ parameters programmatically.  I just need to know the commands I should use in Visual Basic to actually execute the INSERT command.  Thanks for the help.

View 2 Replies View Related

Need Help Inserting From SqlDataSource

Feb 18, 2008

If anyone can see what else I need to insert the stuff below into my database, I'd really appreciate it. I get intellisense, but also this error: Cannot insert the value NULL into column 'UserID' strUserName = cuwCreate.UserName.ToString
strUserID = Membership.GetUser(strUserName).ProviderUserKey.ToString()
Session("NewUserName") = strUserName
Session("NewUserID") = strUserID  <asp:SqlDataSource ID="srcCreateUser" runat="server" ConnectionString="<%$ ConnectionStrings:webConn %>"
InsertCommand="sp_CreateUser" InsertCommandType="StoredProcedure" SelectCommand="sp_CreateUser"
SelectCommandType="StoredProcedure" UpdateCommand="sp_CreateUser" UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="UserID" SessionField="NewUserID" Type="String" />
<asp:ControlParameter ControlID="UserName" DefaultValue="" Name="UserName" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="Email" Name="Email" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="txtFirstName" Name="FirstName" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="txtLastName" Name="LastName" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="txtTeacher" Name="Teacher" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="txtGradYr" Name="GradYr" PropertyName="Text" Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:SessionParameter Name="UserID" SessionField="NewUserID" Type="String" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="Teacher" Type="String" />
<asp:Parameter Name="GradYr" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>Dim obj As SqlDataSource = cuwRegister.ContentTemplateContainer.FindControl("srcCreateUser")
obj.Insert() 

View 17 Replies View Related







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